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

Method find_remote_client

implementation/endpoints/src/endpoint_manager_impl.cpp:993–1039  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

991}
992
993std::shared_ptr<boardnet_endpoint> endpoint_manager_impl::find_remote_client(service_t _service, instance_t _instance, bool _reliable) {
994
995 std::shared_ptr<boardnet_endpoint> its_endpoint;
996 if (auto found_si = remote_services_.find({_service, _instance}); found_si != remote_services_.end()) {
997 if (auto found_reliability = found_si->second.find(_reliable); found_reliability != found_si->second.end()) {
998 its_endpoint = found_reliability->second;
999 }
1000 }
1001 if (its_endpoint) {
1002 return its_endpoint;
1003 }
1004
1005 // Endpoint did not yet exist. Get the partition id to check
1006 // whether the client endpoint for the partition does exist.
1007 partition_id_t its_partition_id = configuration_->get_partition_id(_service, _instance);
1008
1009 // If another service within the same partition is hosted on the
1010 // same server_endpoint reuse the existing client_endpoint.
1011 if (auto found_si_info = remote_service_info_.find({_service, _instance}); found_si_info != remote_service_info_.end()) {
1012 if (auto found_reliable = found_si_info->second.find(_reliable); found_reliable != found_si_info->second.end()) {
1013 std::shared_ptr<endpoint_definition> its_ep_def = found_reliable->second;
1014 if (auto found_address = client_endpoints_.find(its_ep_def->get_address()); found_address != client_endpoints_.end()) {
1015 if (auto found_port = found_address->second.find(its_ep_def->get_remote_port());
1016 found_port != found_address->second.end()) {
1017 if (auto found_reliable2 = found_port->second.find(_reliable); found_reliable2 != found_port->second.end()) {
1018 if (auto found_partition = found_reliable2->second.find(its_partition_id);
1019 found_partition != found_reliable2->second.end()) {
1020 its_endpoint = found_partition->second;
1021
1022 // store the endpoint under this service/instance id
1023 // as well - needed for later cleanup
1024 remote_services_[{_service, _instance}][_reliable] = its_endpoint;
1025 service_instances_[_service][its_endpoint.get()] = _instance;
1026
1027 // add endpoint to serviceinfo object
1028 if (auto found_service_info_inner = router_->find_service(_service, _instance); found_service_info_inner) {
1029 found_service_info_inner->set_endpoint(its_endpoint, _reliable);
1030 }
1031 }
1032 }
1033 }
1034 }
1035 }
1036 }
1037
1038 return its_endpoint;
1039}
1040
1041std::shared_ptr<boardnet_endpoint> endpoint_manager_impl::create_remote_client(service_t _service, instance_t _instance, bool _reliable) {
1042 std::shared_ptr<boardnet_endpoint> its_endpoint;

Callers

nothing calls this directly

Calls 7

endMethod · 0.80
get_partition_idMethod · 0.80
get_addressMethod · 0.45
get_remote_portMethod · 0.45
getMethod · 0.45
find_serviceMethod · 0.45
set_endpointMethod · 0.45

Tested by

no test coverage detected