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

Method stop_internal

implementation/endpoints/src/local_endpoint.cpp:263–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261}
262
263void local_endpoint::stop_internal(std::unique_lock<std::mutex>& lock, bool _due_to_error) {
264 if (state_ == state_e::STOPPED) {
265 return;
266 }
267 if (connect_debounce_) {
268 connect_debounce_->stop();
269 }
270 if (connecting_timebox_) {
271 connecting_timebox_->stop();
272 }
273
274 uint32_t retry_count(0);
275 while (true) {
276 if (is_sending_) {
277 if (_due_to_error || state_ == state_e::FAILED) {
278 VSOMEIP_WARNING_P << "Stop due to error, will lose data, " << status_unlock();
279 break;
280 } else {
281 VSOMEIP_WARNING_P << "Waiting [" << retry_count << "] to complete send, " << status_unlock();
282
283 lock.unlock();
284 std::this_thread::sleep_for(std::chrono::milliseconds(VSOMEIP_LOCAL_CLOSE_SEND_BUFFER_CHECK_PERIOD));
285 lock.lock();
286 }
287 } else {
288 break;
289 }
290 ++retry_count;
291 if (retry_count > VSOMEIP_LOCAL_CLOSE_SEND_BUFFER_RETRIES) {
292 VSOMEIP_WARNING_P << "Max retries reached to send! will lose data, " << status_unlock();
293 break;
294 }
295 }
296
297 socket_->stop(state_ == state_e::FAILED || _due_to_error);
298 set_state_unlocked(state_e::STOPPED);
299}
300
301void local_endpoint::set_state_unlocked(state_e _state) {
302 if (state_ == _state) {

Callers

nothing calls this directly

Calls 3

unlockMethod · 0.80
lockMethod · 0.80
stopMethod · 0.45

Tested by

no test coverage detected