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

Method set_client_target

implementation/endpoints/src/server_endpoint_impl.cpp:226–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224
225template<typename Protocol>
226void server_endpoint_impl<Protocol>::set_client_target(const clients_key_t _client, const endpoint_type& _target) {
227 std::scoped_lock its_clients_lock{clients_mutex_};
228 if (auto it = clients_to_target_.find(_client); it != clients_to_target_.end()) {
229 auto& [id, current_target] = *it;
230 // different ECUs using the same client-id? CATASTROPHIC! we will lose responses to the old ECU..
231 if (current_target != _target) {
232 const auto service = static_cast<uint16_t>((_client >> 48) & 0xffff);
233 const auto method = static_cast<uint16_t>((_client >> 32) & 0xffff);
234 const auto client = static_cast<uint16_t>((_client >> 16) & 0xffff);
235 VSOMEIP_ERROR_P << "Target replaced. May cause pending response to be lost. message=" << hex4(service) << "." << hex4(method)
236 << " client=" << hex4(client) << " old=" << current_target << " new=" << _target;
237 }
238 }
239 clients_to_target_[_client] = _target;
240}
241
242template<typename Protocol>
243std::optional<typename Protocol::endpoint> server_endpoint_impl<Protocol>::get_client_target(const clients_key_t _client) {

Callers 1

receive_cbkMethod · 0.45

Calls 2

hex4Function · 0.85
endMethod · 0.80

Tested by

no test coverage detected