src/network/master.cpp File Reference

#include "tConfiguration.h"
#include "tDirectories.h"
#include "nNetwork.h"
#include "nServerInfo.h"
#include "tSysTime.h"
#include "tLocale.h"
#include "tCommandLine.h"
#include "nSocket.h"
#include <time.h>

Include dependency graph for master.cpp:

Go to the source code of this file.

Classes

class  nConsoleDateFilter

Functions

int main (int argc, char **argv)

Variables

REAL save_interval = 300.0f
static tSettingItem< REALsi ("MASTER_SAVE_INTERVAL", save_interval)
REAL query_interval = 10.0f
static tSettingItem< REALqi ("MASTER_QUERY_INTERVAL", query_interval)
int master_port = 4533
static tSettingItem< int > mp ("MASTER_PORT", master_port)
REAL master_idle = 2
static tSettingItem< REALmi ("MASTER_IDLE", master_idle)
static nConsoleDateFilter sn_consoleFilter


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 72 of file master.cpp.

References tCommandLineData::Analyse(), tLocale::Clear(), nServerInfo::DeleteAll(), nServerInfo::DoQueryAll(), nServerInfo::GetMasters(), nServerInfo::Load(), tLocale::Load(), master_idle, master_port, nSERVER, tCommandLineData::programVersion_, query_interval, nServerInfo::RunMaster(), nServerInfo::Save(), save_interval, nBasicNetworkSystem::Select(), sn_BasicNetworkSystem, sn_programVersion, sn_Receive(), sn_ReceiveFromControlSocket(), sn_SendPlanned(), sn_serverPort, sn_SetNetState(), st_LoadConfig(), nServerInfo::StartQueryAll(), tAdvanceFrame(), tSysTimeFloat(), and tDirectories::Var().

00073 {
00074     tCommandLineData commandLine;
00075     commandLine.programVersion_ = &sn_programVersion;
00076     commandLine.Analyse(argc, argv);
00077     tLocale::Load("languages.txt");
00078     atexit(tLocale::Clear);
00079 
00080     st_LoadConfig();
00081 
00082     nServerInfo::GetMasters();
00083 
00084 
00085 #ifdef DEBUG
00086     // std::istringstream s("SERVER_IP ANY");
00087     // tConfItemBase::LoadAll( s );
00088 #endif
00089 
00090     nServerInfo::Load( tDirectories::Var(), "master_list.srv" );
00091 
00092     nServerInfo::StartQueryAll();
00093     //  st_LoadConfig();
00094 
00095     sn_serverPort = master_port;
00096     sn_SetNetState(nSERVER);
00097 
00098     nTimeAbsolute savetimeout  = tSysTimeFloat();
00099     nTimeAbsolute querytimeout = tSysTimeFloat();
00100     nTimeAbsolute quitTimeout  = tSysTimeFloat() + master_idle * 3600;
00101 
00102     bool goon = true;
00103     while ( goon )
00104     {
00105         nServerInfo::RunMaster();
00106 
00107         sn_BasicNetworkSystem.Select( .1f );
00108         tAdvanceFrame();
00109         nTimeAbsolute time = tSysTimeFloat();
00110 
00111         sn_Receive();
00112         sn_ReceiveFromControlSocket();
00113         sn_SendPlanned();
00114 
00115         static bool queryGoesOn = true;
00116         if (queryGoesOn && time > querytimeout)
00117         {
00118             queryGoesOn = nServerInfo::DoQueryAll(1);
00119             querytimeout = time + query_interval;
00120         }
00121 
00122         if (time > savetimeout)
00123         {
00124             nServerInfo::Save( tDirectories::Var(), "master_list.srv" );
00125             if (!queryGoesOn)
00126             {
00127                 nServerInfo::StartQueryAll();
00128                 queryGoesOn = true;
00129             }
00130             savetimeout = time + save_interval;
00131 
00132             goon = time < quitTimeout;
00133         }
00134     }
00135 
00136     nServerInfo::DeleteAll();
00137 
00138     return(0);
00139 }

Here is the call graph for this function:


Variable Documentation

REAL master_idle = 2

Definition at line 47 of file master.cpp.

Referenced by main().

int master_port = 4533

Definition at line 44 of file master.cpp.

Referenced by main().

tSettingItem< REAL > mi("MASTER_IDLE", master_idle) [static]

Referenced by gServerMenu::Update().

tSettingItem< int > mp("MASTER_PORT", master_port) [static]

Referenced by _wrap_GCycle_mp_set(), and MainMenu().

tSettingItem< REAL > qi("MASTER_QUERY_INTERVAL", query_interval) [static]

REAL query_interval = 10.0f

Definition at line 41 of file master.cpp.

Referenced by main().

REAL save_interval = 300.0f

Definition at line 38 of file master.cpp.

Referenced by main().

tSettingItem< REAL > si("MASTER_SAVE_INTERVAL", save_interval) [static]

Referenced by pGetParticles().

nConsoleDateFilter sn_consoleFilter [static]

Definition at line 70 of file master.cpp.


Generated on Sat Mar 15 23:00:17 2008 for Armagetron Advanced by  doxygen 1.5.4