| 2638 | } |
| 2639 | |
| 2640 | void routing_manager_impl::cleanup_client(client_t _client) { |
| 2641 | VSOMEIP_INFO_P << "self 0x" << hex4(get_client()) << " handles cleanup of client 0x" << hex4(_client); |
| 2642 | |
| 2643 | // Since the client could be offering services that need to be removed |
| 2644 | // lock the offer serialization mutex. This is needed here to prevent |
| 2645 | // a lock inversion with rms routing_info_mutex_ |
| 2646 | { |
| 2647 | std::scoped_lock its_lock{offer_serialization_mutex_}; |
| 2648 | stub_->deregister_client(_client); |
| 2649 | } |
| 2650 | |
| 2651 | std::forward_list<std::tuple<client_t, service_t, instance_t, major_version_t, minor_version_t>> its_offers; |
| 2652 | { |
| 2653 | std::scoped_lock its_lock{services_state_mutex_}; |
| 2654 | remove_pending_requests_unlocked(pending_request_removal_type_e::BOTH, _client); |
| 2655 | if (pending_offers_.size() == 0) { |
| 2656 | return; |
| 2657 | } |
| 2658 | |
| 2659 | std::erase_if(pending_offers_, [&its_offers, _client](const auto& pending_offer) { |
| 2660 | const auto& [service_instance, offer_info] = pending_offer; |
| 2661 | const auto& [major, minor, new_client, old_client] = offer_info; |
| 2662 | if (old_client == _client) { |
| 2663 | VSOMEIP_WARNING << "OFFER(" << hex4(new_client) << "): [" << hex4(service_instance.service()) << "." |
| 2664 | << hex4(service_instance.instance()) << ":" << std::uint32_t(major) << "." << minor |
| 2665 | << "] is not pending anymore as application: " << hex4(old_client) << " is dead. Offering again!"; |
| 2666 | its_offers.push_front(std::make_tuple(new_client, service_instance.service(), service_instance.instance(), major, minor)); |
| 2667 | return true; |
| 2668 | } |
| 2669 | return false; |
| 2670 | }); |
| 2671 | } |
| 2672 | for (const auto& [client, service, instance, major, minor] : its_offers) { |
| 2673 | offer_service(client, service, instance, major, minor, true); |
| 2674 | } |
| 2675 | } |
| 2676 | |
| 2677 | std::shared_ptr<endpoint_manager_impl> routing_manager_impl::get_endpoint_manager() const { |
| 2678 | return ep_mgr_impl_; |
no test coverage detected