Skip to content

Commit

Permalink
main_phase_timer should be stopped along with SD (#740)
Browse files Browse the repository at this point in the history
* main_phase_timer should be stopped along with SD

If not stopped, it might prevent routingmanagerd from quitting
gracefully. Thread will be blocked on join().

* fixup! main_phase_timer should be stopped along with SD

Swapped lock_guard for a scoped_lock

---------

Co-authored-by: Eugene Kozlov <[email protected]>
  • Loading branch information
kheaactua and Eugene Kozlov committed Sep 11, 2024
1 parent 637fb6c commit fd7758c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ class service_discovery_impl: public service_discovery,

void start_main_phase_timer();
void on_main_phase_timer_expired(const boost::system::error_code &_error);
void stop_main_phase_timer();


void send_uni_or_multicast_offerservice(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ service_discovery_impl::stop() {
is_suspended_ = true;
stop_ttl_timer();
stop_last_msg_received_timer();
stop_main_phase_timer();
}

void
Expand Down Expand Up @@ -3235,6 +3236,13 @@ service_discovery_impl::start_main_phase_timer() {
this, std::placeholders::_1));
}

void
service_discovery_impl::stop_main_phase_timer() {
std::scoped_lock<std::mutex> its_lock(main_phase_timer_mutex_);
boost::system::error_code ec;
main_phase_timer_.cancel(ec);
}

void
service_discovery_impl::on_main_phase_timer_expired(
const boost::system::error_code &_error) {
Expand Down

0 comments on commit fd7758c

Please sign in to comment.