/// <summary>
/// This method initializes the server communicator (one-time startup
/// processing).
/// </summary>
private void InitializeServerCommunicator()
{
int ServerId;
if (Database == null)
Database = new ALFA.Database(this);
ServerId = Database.ACR_GetServerID();
WorldManager = new GameWorldManager(
ServerId,
GetName(GetModule()));
NetworkManager = new ServerNetworkManager(WorldManager, ServerId, this);
PlayerStateTable = new Dictionary<uint, PlayerState>();
//
// Remove any stale IPC commands to this server, as we are starting
// up fresh.
//
Database.ACR_SQLExecute(String.Format(
"DELETE FROM `server_ipc_events` WHERE `DestinationServerID`={0}",
Database.ACR_GetServerID()));
WriteTimestampedLogEntry(String.Format(
"ACR_ServerCommunicator.InitializeServerCommunicator: Purged {0} old records from server_ipc_events for server id {1}.",
Database.ACR_SQLGetAffectedRows(),
Database.ACR_GetServerID()));
WriteTimestampedLogEntry(String.Format(
"ACR_ServerCommunicator.InitializeServerCommunicator: Server started with ACR version {0} and IPC subsystem version {1}.",
Database.ACR_GetVersion(),
Assembly.GetExecutingAssembly().GetName().Version.ToString()));
if (GetLocalInt(GetModule(), "ACR_SERVER_IPC_DISABLE_LATENCY_CHECK") == FALSE)
EnableLatencyCheck = true;
else
EnableLatencyCheck = false;
if (!EnableLatencyCheck)
WriteTimestampedLogEntry("ACR_ServerCommunicator.InitializeServerCommunicator: Latency check turned off by configuration.");
WorldManager.SynchronizeInitialConfiguration(Database);
RecordModuleResources();
PatchContentFiles();
ConfigureWer();
RunPatchInitScript();
//
// Finally, drop into the command polling loop.
//
CommandDispatchLoop();
UpdateServerExternalAddress();
}