Пример #1
0
    void connection_oriented_network::on_server_session_accepted(rpc_server_session_ptr& s)
    {
        dinfo("server session %s:%hu accepted", s->remote_address().name.c_str(), s->remote_address().port);

        utils::auto_write_lock l(_servers_lock);
        _servers.insert(server_sessions::value_type(s->remote_address(), s));

    }
Пример #2
0
    void connection_oriented_network::on_server_session_disconnected(rpc_server_session_ptr& s)
    {
        bool r = false;
        {
            utils::auto_write_lock l(_servers_lock);
            auto it = _servers.find(s->remote_address());
            if (it != _servers.end() && it->second.get() == s.get())
            {
                _servers.erase(it);
                r = true;
            }                
        }

        if (r)
        {
            dinfo("server session %s:%d disconnected", 
                s->remote_address().name.c_str(),
                static_cast<int>(s->remote_address().port));
        }
    }