Skip to content

Commit fd7758c

Browse files
kheaactuaEugene Kozlov
andauthored
main_phase_timer should be stopped along with SD (#740)
* 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]>
1 parent 637fb6c commit fd7758c

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

implementation/service_discovery/include/service_discovery_impl.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ class service_discovery_impl: public service_discovery,
264264

265265
void start_main_phase_timer();
266266
void on_main_phase_timer_expired(const boost::system::error_code &_error);
267+
void stop_main_phase_timer();
267268

268269

269270
void send_uni_or_multicast_offerservice(

implementation/service_discovery/src/service_discovery_impl.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ service_discovery_impl::stop() {
206206
is_suspended_ = true;
207207
stop_ttl_timer();
208208
stop_last_msg_received_timer();
209+
stop_main_phase_timer();
209210
}
210211

211212
void
@@ -3235,6 +3236,13 @@ service_discovery_impl::start_main_phase_timer() {
32353236
this, std::placeholders::_1));
32363237
}
32373238

3239+
void
3240+
service_discovery_impl::stop_main_phase_timer() {
3241+
std::scoped_lock<std::mutex> its_lock(main_phase_timer_mutex_);
3242+
boost::system::error_code ec;
3243+
main_phase_timer_.cancel(ec);
3244+
}
3245+
32383246
void
32393247
service_discovery_impl::on_main_phase_timer_expired(
32403248
const boost::system::error_code &_error) {

0 commit comments

Comments
 (0)