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

Method drop_from

implementation/endpoints/src/endpoint_manager_impl.cpp:1265–1291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1263}
1264
1265void endpoint_manager_impl::drop_from(const boost::asio::ip::address& _address) {
1266 std::scoped_lock const its_endpoint_lock{routing_endpoint_mtx_};
1267 for (auto const& [client, ep] : routing_endpoints_) {
1268 bool const drop = _address == ep->peer_endpoint().address();
1269 if (drop) {
1270 VSOMEIP_INFO_P << "dropping connection for client: " << hex4(client) << ", " << ep->name();
1271 // this is technically not correct, but it should be good enough for now.
1272 ep->trigger_error(); // ensure that we do all the clean-up
1273 }
1274 }
1275 // important to have the lock still acquired, because the endpoints error handler
1276 // might try to remove something and the pending endpoint should not be promoted due to this.
1277 for (auto itr = pending_routing_endpoints_.begin(); itr != pending_routing_endpoints_.end();) {
1278 client_t client = itr->first;
1279 std::shared_ptr<local_endpoint>& ep = itr->second;
1280 bool const drop = ep->peer_endpoint().address() == _address;
1281
1282 if (drop) {
1283 VSOMEIP_INFO_P << "dropping pending connection for client " << hex4(client) << ", " << ep->name();
1284 // immediate, data loss is OK
1285 ep->stop(true);
1286 itr = pending_routing_endpoints_.erase(itr);
1287 } else {
1288 ++itr;
1289 }
1290 }
1291}
1292
1293void endpoint_manager_impl::add_local_routing_endpoint(std::shared_ptr<local_endpoint> _ep) {
1294 auto const client = _ep->connected_client();

Callers 1

Calls 7

hex4Function · 0.85
trigger_errorMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
peer_endpointMethod · 0.45
nameMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected