| 224 | |
| 225 | template<typename Protocol> |
| 226 | void 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 | |
| 242 | template<typename Protocol> |
| 243 | std::optional<typename Protocol::endpoint> server_endpoint_impl<Protocol>::get_client_target(const clients_key_t _client) { |
no test coverage detected