void login_server::on_disconnect( int client_id,tcp_session_ptr conn_ptr ) { if(conn_ptr->get_session_status()!=gs_connecting) conn_ptr->stop(); else return; if(client_id == GATE_SVR_NET_ID) { _map_client.clear(); } }
void login_server::connect(tcp_session_ptr connector, const char* ip_str, const char* port_str ) { if(connector->get_session_status()>gs_null) return; connector->set_session_status(gs_connecting); tcp::resolver resolver(connector->socket().get_io_service()); tcp::resolver::query query(ip_str, port_str); tcp::resolver::iterator iterator = resolver.resolve(query); boost::asio::async_connect(connector->socket(), iterator, boost::bind(&login_server::handle_connect,this,connector, boost::asio::placeholders::error)); }