-
Notifications
You must be signed in to change notification settings - Fork 54
Only check GZ_TRANSPORT_TOPIC_STATISTICS once (backport #731) #743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gz-transport15
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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; | ||||||
|
|
@@ -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. | ||||||
|
|
@@ -1653,8 +1650,14 @@ namespace gz | |||||
|
|
||||||
| /// \brief Wire protocol version. Bump up the version number if you modify | ||||||
| /// the wire protocol (for discovery or message/service exchange). | ||||||
| /// Note: Deprecated: Use wireVersion instead. | ||||||
| private: static const uint8_t kWireVersion = 10; | ||||||
|
|
||||||
| /// \brief Wire protocol version. Bump up the version number if you modify | ||||||
| /// the wire protocol (for discovery or message/service exchange). | ||||||
| /// \TODO(caguero): Remove static in Gazebo K. | ||||||
| private: static uint8_t wireVersion; | ||||||
|
||||||
| private: static uint8_t wireVersion; | |
| private: static inline uint8_t wireVersion = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in ac61c48.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed if we use static inline as suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, removed in ac61c48.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we be sure that
Discoveryis constructed only once?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's constructed twice, one for msgs and one for services here.
Are you thinking on race conditions? If so, they're constructed in sequence, so I think we should be good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I'm concerned that the since
wireVersionis a static variable, every construction of the same template type would increment the wire version. I guess I'm not sure why it needs to be static at all if each instance will end up computing thewireVersionanyway.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason to make it static is to preserve ABI.