int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd ) { g_hInst = hInstance; g_Config.ChangePathName( "settings.ini" ); g_Config.LoadConfigFile( NULL, NULL ); // Read the user's favorites. if ( g_Config.SetSection("Favorites")) { const char *key; const char *value; while ( g_Config.NextInSection( key, value )) { FAVORITE_s fav; strncpy( fav.szName, key, 128 ); fav.szName[128] = 0; strncpy( fav.szAddress, value, strchr( value, '/' ) - value ); fav.szAddress[strchr( value, '/' ) - value] = 0; strncpy( fav.szPassword, strchr( value, '/' ) + 1, 128 ); fav.szPassword[128] = 0; g_Favorites.push_back( fav ); } } NETWORK_Construct( 99999 ); main_SetState( STATE_WAITING ); DialogBox( g_hInst, MAKEINTRESOURCE( IDD_CONNECTDIALOG ), NULL, main_ConnectDialogCallback ); }
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd ) { g_hInst = hInstance; // First, start networking. NETWORK_Construct( DEFAULT_STATS_PORT, false ); main_SetupProtocols ( ); // Create the dialog, which will call COLLECTOR_StartCollecting. GUI_CreateDialog( ); return 0; }
//***************************************************************************** // int main( int argc, char **argv ) { BYTESTREAM_s *pByteStream; std::cerr << "=== Zandronum Master ===\n"; std::cerr << "Revision: "SVN_REVISION_STRING"\n"; std::cerr << "Port: " << DEFAULT_MASTER_PORT << std::endl << std::endl; // Initialize the network system. NETWORK_Construct( DEFAULT_MASTER_PORT, ( ( argc >= 4 ) && ( stricmp ( argv[2], "-useip" ) == 0 ) ) ? argv[3] : NULL ); // Initialize the message buffer we send messages to the launcher in. NETWORK_InitBuffer( &g_MessageBuffer, MAX_UDP_PACKET, BUFFERTYPE_WRITE ); NETWORK_ClearBuffer( &g_MessageBuffer ); // Initialize the bans subsystem. std::cerr << "Initializing ban list...\n"; MASTERSERVER_InitializeBans( ); int lastParsingTime = I_GetTime( ); int lastBanlistVerificationTimeout = lastParsingTime; // [BB] Do we want to hide servers that ignore our ban list? if ( ( argc >= 2 ) && ( stricmp ( argv[1], "-DontHideBanIgnoringServers" ) == 0 ) ) { std::cerr << "Note: Servers that do not enforce our ban list are shown." << std::endl; g_bHideBanIgnoringServers = false; } else { std::cerr << "Note: Servers that do not enforce our ban list are hidden." << std::endl; g_bHideBanIgnoringServers = true; } // Done setting up! std::cerr << "\n=== Master server started! ===\n"; while ( 1 ) { g_lCurrentTime = I_GetTime( ); I_DoSelect( ); while ( NETWORK_GetPackets( )) { // Set up our byte stream. pByteStream = &NETWORK_GetNetworkMessageBuffer( )->ByteStream; pByteStream->pbStream = NETWORK_GetNetworkMessageBuffer( )->pbData; pByteStream->pbStreamEnd = pByteStream->pbStream + NETWORK_GetNetworkMessageBuffer( )->ulCurrentSize; // Now parse the packet. MASTERSERVER_ParseCommands( pByteStream ); } // Update the ignore queues. g_queryIPQueue.adjustHead ( g_lCurrentTime ); g_floodProtectionIPQueue.adjustHead ( g_lCurrentTime ); g_ShortFloodQueue.adjustHead ( g_lCurrentTime ); // See if any servers have timed out. MASTERSERVER_CheckTimeouts( ); if ( g_lCurrentTime > lastBanlistVerificationTimeout + 10 ) { for( std::set<SERVER_s, SERVERCompFunc>::iterator it = g_Servers.begin(); it != g_Servers.end(); ++it ) { if ( ( it->bVerifiedLatestBanList == false ) && ( it->bNewFormatServer == true ) ) { it->bHasLatestBanList = false; std::cerr << "No receipt received from " << NETWORK_AddressToString ( it->Address ) << ". Resending banlist.\n"; } } lastBanlistVerificationTimeout = g_lCurrentTime; } // [BB] Reparse the ban list every 15 minutes. if ( g_lCurrentTime > lastParsingTime + 15*60 ) { std::cerr << "~ Reparsing the ban lists...\n"; MASTERSERVER_InitializeBans( ); lastParsingTime = g_lCurrentTime; } } return ( 0 ); }
int main ( ) { NETWORK_Construct( DEFAULT_STATS_PORT, false ); main_SetupProtocols ( ); COLLECTOR_StartCollecting ( ); }