MCPcopy Create free account
hub / github.com/COVESA/vsomeip / stop

Method stop

implementation/routing/src/routing_manager_client.cpp:176–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176void routing_manager_client::stop() {
177 state_machine_->target_shutdown();
178 ep_mgr_->stop();
179 // Transition to ST_DEREGISTERED so that a subsequent start() finds a clean state.
180 // The error handler is suppressed because shall_run_ = false (target_shutdown was called above).
181 {
182 std::scoped_lock its_sender_lock{sender_mutex_};
183 // transition the state under the sender mutex, as this is the one protecting the restart sequence
184 state_machine_->deregistered();
185 if (sender_) {
186 VSOMEIP_INFO_P << "starting to flush the sender";
187 sender_->start_flushing();
188 }
189 }
190
191 {
192 std::scoped_lock its_lock{consumer_mutex_};
193 request_debounce_timer_.cancel();
194 }
195
196 {
197 std::scoped_lock its_receiver_lock(receiver_mutex_);
198 auto stop_and_clear = [](auto& receiver) {
199 if (receiver) {
200 receiver->stop();
201 receiver = nullptr;
202 }
203 };
204 stop_and_clear(tcp_receiver_);
205 stop_and_clear(uds_receiver_);
206 }
207
208 {
209 std::scoped_lock its_lock{log_timer_mutex_};
210 version_log_timer_.cancel();
211 status_log_timer_.cancel();
212 }
213 if (!ep_mgr_->await_stopped(std::chrono::milliseconds(500))) {
214 VSOMEIP_WARNING_P << "Not all endpoints could be flushed within time";
215 ep_mgr_->clear_consumer_endpoints();
216 ep_mgr_->clear_provider_endpoints();
217 }
218 {
219 std::unique_lock its_lock(sender_mutex_);
220 if (sender_) {
221 if (!sender_cv_.wait_for(its_lock, std::chrono::milliseconds(500), [this] { return !sender_; })) {
222 VSOMEIP_WARNING << "rmc::stop sender was not flushed successfully";
223 // sender is not null, since the predicate is still true
224 sender_->stop(true);
225 // delete the sender
226 sender_ = nullptr;
227 }
228 }
229 }
230 {
231 // By now all endpoints have been stopped
232 // -> all still queued continuations will be marked "stale"
233 std::scoped_lock its_lock(provider_mutex_);

Callers 3

reconnectMethod · 0.45
cleanup_clientMethod · 0.45
restart_senderMethod · 0.45

Calls 9

target_shutdownMethod · 0.80
deregisteredMethod · 0.80
start_flushingMethod · 0.80
await_stoppedMethod · 0.80
wait_forMethod · 0.80
cancelMethod · 0.45
on_stateMethod · 0.45

Tested by

no test coverage detected