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

Method check_subscription_state

implementation/runtime/src/application_impl.cpp:2066–2102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2064}
2065
2066bool application_impl::check_subscription_state(service_t _service, instance_t _instance, eventgroup_t _eventgroup, event_t _event) {
2067
2068 bool is_acknowledged(false);
2069 bool should_subscribe(true);
2070 {
2071 bool has_found(false);
2072
2073 std::scoped_lock its_lock{subscriptions_state_mutex_};
2074 if (auto its_si = subscriptions_state_.find({_service, _instance}); its_si != subscriptions_state_.end()) {
2075 if (auto its_eventgroup = its_si->second.find(_eventgroup); its_eventgroup != its_si->second.end()) {
2076 if (auto its_event = its_eventgroup->second.find(_event); its_event != its_eventgroup->second.end()) {
2077 if (its_event->second != subscription_state_e::SUBSCRIPTION_NOT_ACKNOWLEDGED) {
2078 has_found = true;
2079
2080 // only return true if subscription is NACK
2081 // as only then we need to subscribe!
2082 should_subscribe = false;
2083 if (its_event->second == subscription_state_e::SUBSCRIPTION_ACKNOWLEDGED) {
2084 is_acknowledged = true;
2085 }
2086 }
2087 }
2088 }
2089 }
2090
2091 if (!has_found) {
2092 subscriptions_state_[{_service, _instance}][_eventgroup][_event] = subscription_state_e::IS_SUBSCRIBING;
2093 }
2094 }
2095
2096 if (!should_subscribe && is_acknowledged) {
2097 // Deliver subscription state only if ACK has already received
2098 deliver_subscription_state(_service, _instance, _eventgroup, _event, 0 /* OK */);
2099 }
2100
2101 return should_subscribe;
2102}
2103
2104void application_impl::print_blocking_call(const std::shared_ptr<sync_handler>& _handler) {
2105 switch (_handler->handler_type_) {

Callers

nothing calls this directly

Calls 1

endMethod · 0.80

Tested by

no test coverage detected