| 339 | } |
| 340 | |
| 341 | void 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 | |
| 365 | void tcp_server_endpoint_impl::accept_cbk(connection::ptr _connection, std::shared_ptr<endpoint_type> _remote_ep, |
| 366 | boost::system::error_code const& _error) { |
no test coverage detected