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

Method remove_connection

implementation/endpoints/src/tcp_server_endpoint_impl.cpp:341–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339}
340
341void tcp_server_endpoint_impl::remove_connection(endpoint_type _endpoint, connection* _connection) {
342 connection::ptr its_old_connection;
343 {
344 std::scoped_lock its_lock(connections_mutex_);
345 if (auto its_itr = connections_.find(_endpoint); its_itr != connections_.end() && its_itr->second.get() == _connection) {
346 its_old_connection = its_itr->second;
347 if (!connections_.erase(_endpoint)) {
348 VSOMEIP_WARNING_P << instance_name_ << " Remote endpoint: " << _endpoint
349 << " has no registered connection to remove, endpoint > " << this;
350 }
351 // if client still has a connection but a different one
352 } else if (its_itr != connections_.end() && its_itr->second.get() != _connection) {
353 VSOMEIP_WARNING_P << instance_name_ << " Tried to remove old connection " << _connection << " for endpoint " << _endpoint
354 << " new connection: " << connections_[_endpoint];
355 its_old_connection = _connection->shared_from_this();
356 }
357 }
358
359 if (its_old_connection) {
360 its_old_connection->stop();
361 its_old_connection.reset();
362 }
363}
364
365void tcp_server_endpoint_impl::accept_cbk(connection::ptr _connection, std::shared_ptr<endpoint_type> _remote_ep,
366 boost::system::error_code const& _error) {

Callers 2

wait_until_sentMethod · 0.80

Calls 4

endMethod · 0.80
getMethod · 0.45
stopMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected