/* =================== RequestList Request list of game servers from master =================== */ void CHudServers::RequestList( void ) { m_nRequesting = 1; m_nDone = 0; m_dStarted = m_fElapsed; int count = 0; netadr_t adr; if ( !LoadMasterAddresses( 1, &count, &adr ) ) { gEngfuncs.Con_DPrintf( "SendRequest: Unable to read master server addresses\n" ); return; } ClearRequestList( &m_pActiveList ); ClearRequestList( &m_pServerList ); ClearServerList( &m_pServers ); m_nServerCount = 0; // Make sure networking system has started. NET_API->InitNetworking(); // Kill off left overs if any NET_API->CancelAllRequests(); // Request Server List from master NET_API->SendRequest( context_id++, NETAPI_REQUEST_SERVERLIST, 0, 5.0, &adr, ::ListResponse ); }
/* =================== ~CHudServers =================== */ CHudServers::~CHudServers( void ) { ClearRequestList( &m_pActiveList ); ClearRequestList( &m_pServerList ); ClearServerList( &m_pServers ); m_nServerCount = 0; if ( m_pPingRequest ) { delete m_pPingRequest; m_pPingRequest = NULL; } if ( m_pRulesRequest ) { delete m_pRulesRequest; m_pRulesRequest = NULL; } if ( m_pPlayersRequest ) { delete m_pPlayersRequest; m_pPlayersRequest = NULL; } }
void CHudServers::RequestBroadcastList( int clearpending ) { m_nRequesting = 1; m_nDone = 0; m_dStarted = m_fElapsed; netadr_t adr; memset( &adr, 0, sizeof( adr ) ); if ( clearpending ) { ClearRequestList( &m_pActiveList ); ClearRequestList( &m_pServerList ); ClearServerList( &m_pServers ); m_nServerCount = 0; } // Make sure to byte swap server if necessary ( using "host" to "net" conversion adr.port = htons( PORT_SERVER ); // Make sure networking system has started. NET_API->InitNetworking(); if ( clearpending ) { // Kill off left overs if any NET_API->CancelAllRequests(); } adr.type = NA_BROADCAST; // Request Servers from LAN via IP NET_API->SendRequest( context_id++, NETAPI_REQUEST_DETAILS, FNETAPI_MULTIPLE_RESPONSE, 5.0, &adr, ::ServerResponse ); adr.type = NA_BROADCAST_IPX; // Request Servers from LAN via IPX ( if supported ) NET_API->SendRequest( context_id++, NETAPI_REQUEST_DETAILS, FNETAPI_MULTIPLE_RESPONSE, 5.0, &adr, ::ServerResponse ); }
void ServerBrowserExit() { if(m_pUpdater) { if(m_pUpdater->IsUpdating()) { m_bShutdownPending = true; m_pUpdater->CancelUpdate(); if(m_hEventShutdown) { AtlWaitWithMessageLoop(m_hEventShutdown); CloseHandle(m_hEventShutdown); m_hEventShutdown = NULL; } } m_pUpdater->Cleanup(); delete m_pUpdater; m_pUpdater = NULL; ClearServerList(); } }
MasterClient::~MasterClient() { ClearServerList(); }
static void Update() { try { if(!m_pUpdater) { m_pUpdater = new GNetUpdater; if(!m_pUpdater) throw _com_error(E_OUTOFMEMORY); m_pUpdater->Init(); } if(m_pUpdater->IsUpdating()) { m_pUpdater->CancelUpdate(); UpdateStatus("Aborting ..."); } else { m_pListServers->DeleteBranch(m_pListServers->GetRoot()); // Delete all items ClearServerList(); #if 0 // Adjust maximum number of concurent server quries according to phonebook bandwidth settings C_Window *pWin = gMainHandler->FindWindow(PB_WIN); if(pWin) { C_ListBox *pListBox = (C_ListBox *) pWin->FindControl(SET_JETNET_BANDWIDTH); if(pListBox) { static int Bandwidth2MaxConcurentQueries[] = { 4, // INVALID 4, // F4_BANDWIDTH_14 4, // F4_BANDWIDTH_28 8, // F4_BANDWIDTH_33 15, // F4_BANDWIDTH_56Modem 15, // F4_BANDWIDTH_56ISDN 20, // F4_BANDWIDTH_112 20, // F4_BANDWIDTH_256 25 // F4_BANDWIDTH_T1 }; int nBandwidth = static_cast<uchar>(pListBox->GetTextID()); if(nBandwidth < 0) nBandwidth = 1; else if(nBandwidth > F4_BANDWIDTH_T1) nBandwidth = 1; m_pUpdater->m_pMasterServer->PutMaxConcurrentHostQueries(Bandwidth2MaxConcurentQueries[nBandwidth]); } } #else m_pUpdater->m_pMasterServer->PutMaxConcurrentHostQueries(8); #endif m_nUpdatedServers = 0; m_bConnectedToMaster = false; m_pUpdater->Update(); } } catch(_com_error e) { MonoPrint("Update - _com_error 0x%X", e.Error()); } }
MasterServer::~MasterServer() { ClearServerList(); }