Skip to content

Commit

Permalink
Fix missing/blocked subscription requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Fábio Monteiro authored and Fábio Monteiro committed Jul 29, 2024
1 parent 97fa8f9 commit c670190
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions implementation/routing/include/routing_manager_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ class routing_manager_base : public routing_manager,
const std::shared_ptr<debounce_filter_impl_t> &_filter, client_t _client,
std::set<event_t> *_already_subscribed_events);

void clear_shadow_subscriptions(void);

std::shared_ptr<serializer> get_serializer();
void put_serializer(const std::shared_ptr<serializer> &_serializer);
std::shared_ptr<deserializer> get_deserializer();
Expand Down
15 changes: 14 additions & 1 deletion implementation/routing/src/routing_manager_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const vsomeip_sec_client_t *routing_manager_base::get_sec_client() const {

void routing_manager_base::set_sec_client_port(port_t _port) {

host_->set_sec_client_port(_port);
host_->set_sec_client_port(_port);
}

std::string routing_manager_base::get_client_host() const {
Expand Down Expand Up @@ -1570,6 +1570,19 @@ routing_manager_base::get_subscriptions(const client_t _client) {
return result;
}


void routing_manager_base::clear_shadow_subscriptions(void) {
std::lock_guard<std::mutex> its_lock(events_mutex_);
for (const auto& its_service : events_) {
for (const auto& its_instance : its_service.second) {
for (const auto& its_event : its_instance.second) {
if (its_event.second->is_shadow())
its_event.second->clear_subscribers();
}
}
}
}

bool
routing_manager_base::get_guest(client_t _client,
boost::asio::ip::address &_address, port_t &_port) const {
Expand Down
8 changes: 8 additions & 0 deletions implementation/routing/src/routing_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,11 @@ void routing_manager_impl::subscribe(
eventgroup_t _eventgroup, major_version_t _major,
event_t _event, const std::shared_ptr<debounce_filter_impl_t> &_filter) {

if (routing_state_ == routing_state_e::RS_SUSPENDED) {
VSOMEIP_INFO << "rmi::" << __func__ << " We are suspended --> do nothing.";
return;
}

VSOMEIP_INFO << "SUBSCRIBE("
<< std::hex << std::setfill('0')
<< std::setw(4) << _client << "): ["
Expand Down Expand Up @@ -3830,6 +3835,9 @@ void routing_manager_impl::set_routing_state(routing_state_e _routing_state) {
remote_subscription_state_.clear();
}

// Remove all subscribers to shadow events
clear_shadow_subscriptions();

// send StopSubscribes and clear subscribed_ map
discovery_->unsubscribe_all_on_suspend();

Expand Down

0 comments on commit c670190

Please sign in to comment.