Skip to content

Commit

Permalink
Enable subscription expiration
Browse files Browse the repository at this point in the history
Summary
Allow subscriptions to expire when a reboot or ttl timeout is detected
Details

set_noned() function created in remote_subscription.cpp
added set_noned() at the end of routing_manager_impl::on_remote_subscribe
to reset the set_forwarded to allow subscriptions to expire in case of
reboot and ttl timeout.
  • Loading branch information
danielsantiago authored and duartenfonseca committed Nov 28, 2024
1 parent 93b7757 commit 8b3c5a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions implementation/routing/include/remote_subscription.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class remote_subscription {
void set_expired();
bool is_forwarded() const;
void set_forwarded();
void clear_destiny();

private:
std::atomic<remote_subscription_id_t> id_;
Expand Down
4 changes: 4 additions & 0 deletions implementation/routing/src/remote_subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,4 +357,8 @@ void remote_subscription::set_forwarded() {
this->final_destination_.store(destiny::forward, std::memory_order_release);
}

void remote_subscription::clear_destiny() {
this->final_destination_.store(destiny::none, std::memory_order_release);
}

} // namespace vsomeip_v3
2 changes: 2 additions & 0 deletions implementation/routing/src/routing_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2991,6 +2991,7 @@ void routing_manager_impl::on_remote_subscribe(

its_update_lock.unlock();
_callback(_subscription);
_subscription->clear_destiny();
return;
}

Expand All @@ -3003,6 +3004,7 @@ void routing_manager_impl::on_remote_subscribe(
its_service, its_instance, its_eventgroup, its_major,
_subscription->get_clients(), its_id);
}
_subscription->clear_destiny();
}

void routing_manager_impl::on_remote_unsubscribe(
Expand Down

0 comments on commit 8b3c5a0

Please sign in to comment.