Exemple #1
0
bool CSynapseServer::Resolve( CSynapseClient *pClient ) {
    bool ret = DoResolve( pClient );
    list<CSynapseClientSlot>::iterator iClient;
    iClient = mClients.begin();
    while ( iClient != mClients.end() )
    {
        CSynapseClient *pClient = ( *iClient ).mpClient;
        if ( !pClient->IsActive() ) {
            Syn_Printf( "Unloading an unused module: '%s'\n", pClient->GetInfo() );
            iClient = ShutdownClient( iClient );
        }
        else {
            iClient++;
        }
    }
    return ret;
}
Exemple #2
0
void CSynapseServer::Shutdown() {
    Syn_Printf( "Synapse server core is shutting down\n" );
    // do a first pass to shutdown the clients nicely (i.e. decref, release memory and drop everything)
    // we seperate the client shutdown calls from the dlclose cause that part is a clean decref / free situation whereas dlclose will break links without advice
    list<CSynapseClientSlot>::iterator iClient;
    iClient = mClients.begin();
    for ( iClient = mClients.begin(); iClient != mClients.end(); iClient++ )
    {
        ( *iClient ).mpClient->Shutdown();
    }
    // now release them from the server's point of view
    iClient = mClients.begin();
    while ( iClient != mClients.end() )
    {
        iClient = ShutdownClient( iClient );
    }
}
void Connection::HandleMasterJoin()
{
	// The player's client is displaying the inter-sector wait screen
	MasterJoin * join = (MasterJoin *) m_RecvBuffer;
	long sector_id = ntohl(join->ToSectorID);

	m_AvatarID = ntohl(join->avatar_id_lsb);
	//LogMessage("<client> Received MasterJoin packet, ToSectorID = %d [%d] [%d]\n", sector_id, m_AvatarID, ntohl(join->avatar_id_msb));

	g_LoggedIn = true;

    long sector_ipaddr;
    short sector_port;

    g_ServerMgr->m_MasterConnection = this;

    sector_port = g_ServerMgr->m_UDPConnection->SendMasterLogin(m_AvatarID, sector_id, &sector_ipaddr);

	if (sector_port == -1)
	{
		::MessageBox(NULL, "Server Failed to respond to sector login", "Net7Proxy", MB_ICONERROR);
		LogMessage(">> CRITICAL ERROR: Server unable to process sector login\n");
		ShutdownClient();
	}
	else
	{
		LogMessage("<server> Master Login received - UDP sector port: %d\n", sector_port);
		g_ServerMgr->m_UDPConnection->SetClientPort(sector_port);
		g_ServerMgr->m_UDPConnection->SetClientIP(sector_ipaddr);
		g_ServerMgr->m_UDPConnection->SetSectorID(sector_id);
		g_ServerMgr->m_UDPClient->SetSectorID(sector_id);

		// Redirect the client to the appropriate sector server
		SendServerRedirect(sector_id);

		//start login thread here
		g_ServerMgr->m_UDPClient->StartLoginTimer();
	}
}