void connection_oriented_network::on_server_session_accepted(rpc_session_ptr& s) { int scount = 0; { utils::auto_write_lock l(_servers_lock); auto pr = _servers.insert(server_sessions::value_type(s->remote_address(), s)); if (pr.second) { // nothing to do } else { pr.first->second = s; dwarn("server session on %s already exists, preempted", s->remote_address().to_string()); } scount = (int)_servers.size(); } ddebug("server session %s accepted (%d in total)", s->remote_address().to_string(), scount); }
void connection_oriented_network::on_client_session_disconnected(rpc_session_ptr& s) { int scount; bool r = false; { utils::auto_write_lock l(_clients_lock); auto it = _clients.find(s->remote_address()); if (it != _clients.end() && it->second.get() == s.get()) { _clients.erase(it); r = true; } scount = (int)_clients.size(); } if (r) { ddebug("client session %s disconnected (%d in total)", s->remote_address().to_string(), scount); } }
void connection_oriented_network::on_client_session_connected(rpc_session_ptr& s) { int scount = 0; bool r = false; { utils::auto_read_lock l(_clients_lock); auto it = _clients.find(s->remote_address()); if (it != _clients.end() && it->second.get() == s.get()) { r = true; } scount = (int)_clients.size(); } if (r) { ddebug("client session connected, remote_server = %s, current_count = %d", s->remote_address().to_string(), scount); } }