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

Method flush

implementation/endpoints/src/server_endpoint_impl.cpp:441–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

439
440template<typename Protocol>
441bool server_endpoint_impl<Protocol>::flush(endpoint_type _key) {
442
443 bool has_queued(true);
444 bool is_current_train(true);
445
446 std::scoped_lock its_lock(mutex_);
447
448 auto it = targets_.find(_key);
449 if (it == targets_.end())
450 return false;
451
452 auto& its_data = it->second;
453 auto its_train(its_data.train_);
454 if (!its_data.dispatched_trains_.empty()) {
455
456 auto its_dispatched = its_data.dispatched_trains_.begin();
457 if (its_dispatched->first <= its_train->departure_) {
458
459 is_current_train = false;
460 if (!its_dispatched->second.empty()) {
461 its_train = its_dispatched->second.front();
462 its_dispatched->second.pop_front();
463 if (its_dispatched->second.empty()) {
464
465 its_data.dispatched_trains_.erase(its_dispatched);
466 }
467 }
468 }
469 }
470
471 if (!its_train->buffer_->empty()) {
472
473 queue_train(it, its_train);
474
475 // Reset current train if necessary
476 if (is_current_train) {
477 its_train->reset();
478 }
479 } else {
480 has_queued = false;
481 }
482
483 if (!is_current_train || !its_data.dispatched_trains_.empty()) {
484
485 auto its_now(std::chrono::steady_clock::now());
486 start_dispatch_timer(it, its_now);
487 }
488
489 return has_queued;
490}
491
492template<typename Protocol>
493void server_endpoint_impl<Protocol>::connect_cbk(boost::system::error_code const& _error) {

Callers 1

~messageMethod · 0.45

Calls 3

endMethod · 0.80
beginMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected