Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions src/Discovery.hh
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ namespace gz
this->hostInterfaces = determineInterfaces();
}

// Update the wire version if GZ_TRANSPORT_TOPIC_STATISTICS is set.
std::string gzStats;
if (env("GZ_TRANSPORT_TOPIC_STATISTICS", gzStats) && gzStats == "1")
this->wireVersion += 100;

#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
Expand Down Expand Up @@ -1568,15 +1573,7 @@ namespace gz
/// \return The discovery version.
private: uint8_t Version() const
{
static std::string gzStats;
static int topicStats;

if (env("GZ_TRANSPORT_TOPIC_STATISTICS", gzStats) && !gzStats.empty())
{
topicStats = (gzStats == "1");
}

return this->kWireVersion + (topicStats * 100);
return this->wireVersion;
}

/// \brief Register a new network interface in the discovery system.
Expand Down Expand Up @@ -1653,7 +1650,7 @@ namespace gz

/// \brief Wire protocol version. Bump up the version number if you modify
/// the wire protocol (for discovery or message/service exchange).
private: static const uint8_t kWireVersion = 10;
private: uint8_t wireVersion = 10;

/// \brief Port used to broadcast the discovery messages.
private: int port;
Expand Down
Loading