Skip to content

Commit

Permalink
Fix topic/service list inconsistency (#415)
Browse files Browse the repository at this point in the history
* Consider discovery initialized after two heartbeat cycles

Signed-off-by: Carlos Agüero <[email protected]>
  • Loading branch information
caguero authored Jul 13, 2023
1 parent 4af7653 commit b3a8182
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
7 changes: 3 additions & 4 deletions include/gz/transport/Discovery.hh
Original file line number Diff line number Diff line change
Expand Up @@ -713,16 +713,15 @@ namespace ignition
std::lock_guard<std::mutex> lock(this->mutex);
if (!this->initialized)
{
++this->numHeartbeatsUninitialized;
if (this->numHeartbeatsUninitialized == 2)
if (this->numHeartbeatsUninitialized == 2u)
{
// We consider the discovery initialized after two cycles of
// heartbeats sent.
// We consider discovery initialized after two heartbeat cycles.
this->initialized = true;

// Notify anyone waiting for the initialization phase to finish.
this->initializedCv.notify_all();
}
++this->numHeartbeatsUninitialized;
}

this->timeNextHeartbeat = std::chrono::steady_clock::now() +
Expand Down
11 changes: 7 additions & 4 deletions log/test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,15 @@ if (HAVE_IGN_TOOLS)
ruby ${CMAKE_CURRENT_SOURCE_DIR}/ign_log_record_no_overwrite.rb
)

add_test(ign_log_record_force
ruby ${CMAKE_CURRENT_SOURCE_DIR}/ign_log_record_force.rb
)
# Test disabled on Citadel
#add_test(ign_log_record_force
# ruby ${CMAKE_CURRENT_SOURCE_DIR}/ign_log_record_force.rb
#)

set_tests_properties(
ign_log_record_no_overwrite
ign_log_record_force
# Test disabled on Citadel
# ign_log_record_force
PROPERTIES
ENVIRONMENT
"IGN_CONFIG_PATH=${IGN_CONFIG_PATH};IGN_TRANSPORT_LOG_SQL_PATH=${PROJECT_SOURCE_DIR}/log/sql"
Expand Down

0 comments on commit b3a8182

Please sign in to comment.