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

Method process

implementation/endpoints/src/local_endpoint.cpp:452–491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450}
451
452[[nodiscard]] bool local_endpoint::process(size_t _new_bytes, std::unique_lock<std::mutex>& _lock) {
453 if (_new_bytes > 0 && !receive_buffer_->bump_end(_new_bytes)) {
454 VSOMEIP_ERROR_P << "Inconsistent buffer handling, trying add the read of: " << _new_bytes << " bytes, escalating on "
455 << status_unlock();
456 return false;
457 }
458 next_message_result result;
459 auto routing = routing_host_.lock();
460 if (!routing) {
461 return false;
462 }
463
464 // avoid checking every incoming messages, if a client id was already received
465 if (own_ == VSOMEIP_CLIENT_UNSET) {
466 while (receive_buffer_->next_message(result)) {
467 if (auto const id = protocol::read_client_id(result.message_data_, result.message_size_); id != VSOMEIP_CLIENT_UNSET) {
468 own_ = id;
469 if (assignment_timebox_) {
470 assignment_timebox_->stop();
471 }
472 }
473 _lock.unlock(); // fine to unlock, because the caller needs to return, before we would schedule another read
474 routing->on_message(result.message_data_, result.message_size_, peer_data_);
475 _lock.lock(); // because next_message changes internal state -> lock
476 }
477 } else {
478 while (receive_buffer_->next_message(result)) {
479 _lock.unlock(); // fine to unlock, because the caller needs to return, before we would schedule another read
480 routing->on_message(result.message_data_, result.message_size_, peer_data_);
481 _lock.lock(); // because next_message changes internal state -> lock
482 }
483 }
484 if (result.error_) {
485 VSOMEIP_ERROR_P << "Received parsing error, socket > " << status_unlock();
486 return false;
487 }
488 receive_buffer_->shift_front();
489 receive_unlock();
490 return true;
491}
492
493void local_endpoint::assignment_timeout() {
494 std::unique_lock lock{mutex_};

Callers

nothing calls this directly

Calls 8

read_client_idFunction · 0.85
bump_endMethod · 0.80
lockMethod · 0.80
unlockMethod · 0.80
shift_frontMethod · 0.80
next_messageMethod · 0.45
stopMethod · 0.45
on_messageMethod · 0.45

Tested by

no test coverage detected