diff --git a/implementation/service_discovery/include/service_discovery_impl.hpp b/implementation/service_discovery/include/service_discovery_impl.hpp index 200627ccf..961876f13 100644 --- a/implementation/service_discovery/include/service_discovery_impl.hpp +++ b/implementation/service_discovery/include/service_discovery_impl.hpp @@ -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( diff --git a/implementation/service_discovery/src/service_discovery_impl.cpp b/implementation/service_discovery/src/service_discovery_impl.cpp index c38804575..52d42620a 100644 --- a/implementation/service_discovery/src/service_discovery_impl.cpp +++ b/implementation/service_discovery/src/service_discovery_impl.cpp @@ -206,6 +206,7 @@ service_discovery_impl::stop() { is_suspended_ = true; stop_ttl_timer(); stop_last_msg_received_timer(); + stop_main_phase_timer(); } void @@ -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 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) {