EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
eve-server.cpp File Reference
#include "eve-server.h"
#include "../eve-common/EVEVersion.h"
#include "EVEServerConfig.h"
#include "NetService.h"
#include "StaticDataMgr.h"
#include "StatisticMgr.h"
#include "missions/MissionDataMgr.h"
#include "ConsoleCommands.h"
#include "account/AccountService.h"
#include "account/AuthService.h"
#include "account/BrowserLockdownSvc.h"
#include "account/ClientStatMgrService.h"
#include "account/InfoGatheringMgr.h"
#include "account/TutorialService.h"
#include "account/UserService.h"
#include "admin/AlertService.h"
#include "admin/AllCommands.h"
#include "admin/ClientStatLogger.h"
#include "admin/CommandDispatcher.h"
#include "admin/DevToolsProviderService.h"
#include "admin/PetitionerService.h"
#include "admin/SlashService.h"
#include "agents/Agent.h"
#include "agents/AgentMgrService.h"
#include "alliance/AllianceRegistry.h"
#include "system/CalendarMgrService.h"
#include "system/CalendarProxy.h"
#include "cache/BulkDB.h"
#include "cache/BulkMgrService.h"
#include "cache/ObjCacheService.h"
#include "character/AggressionMgrService.h"
#include "character/CertificateMgrService.h"
#include "character/CharFittingMgr.h"
#include "character/CharMgrService.h"
#include "character/CharUnboundMgrService.h"
#include "character/PaperDollService.h"
#include "character/PhotoUploadService.h"
#include "character/SkillMgrService.h"
#include "chat/LookupService.h"
#include "chat/LSCService.h"
#include "chat/OnlineStatusService.h"
#include "chat/VoiceMgrService.h"
#include "config/ConfigService.h"
#include "config/LanguageService.h"
#include "config/LocalizationServerService.h"
#include "contract/ContractMgr.h"
#include "contract/ContractProxy.h"
#include "corporation/BillMgr.h"
#include "corporation/CorpBookmarkMgr.h"
#include "corporation/CorpFittingMgr.h"
#include "corporation/CorpMgrService.h"
#include "corporation/CorporationService.h"
#include "corporation/CorpRegistryService.h"
#include "corporation/CorpStationMgr.h"
#include "corporation/LPService.h"
#include "corporation/LPStore.h"
#include "dogmaim/DogmaIMService.h"
#include "dogmaim/DogmaService.h"
#include "effects/EffectsDataMgr.h"
#include "dungeon/DungeonExplorationMgrService.h"
#include "dungeon/DungeonService.h"
#include "npc/EntityService.h"
#include "exploration/ScanMgrService.h"
#include "faction/FactionWarMgrService.h"
#include "faction/WarRegistryService.h"
#include "fleet/FleetObject.h"
#include "fleet/FleetProxy.h"
#include "fleet/FleetService.h"
#include "imageserver/ImageServer.h"
#include "system/IndexManager.h"
#include "inventory/InvBrokerService.h"
#include "inventory/Voucher.h"
#include "mail/MailMgrService.h"
#include "mail/MailingListMgrService.h"
#include "mail/NotificationMgrService.h"
#include "manufacturing/FactoryService.h"
#include "manufacturing/RamProxyService.h"
#include "map/MapData.h"
#include "map/MapService.h"
#include "market/MarketMgr.h"
#include "market/MarketProxyService.h"
#include "market/MarketBotMgr.h"
#include "missions/MissionMgrService.h"
#include "planet/Planet.h"
#include "planet/PlanetDataMgr.h"
#include "planet/PlanetMgrBound.h"
#include "planet/PlanetORBBound.h"
#include "pos/PosMgr.h"
#include "pos/Structure.h"
#include "qaTools/encounterSpawnServer.h"
#include "qaTools/netStateServer.h"
#include "qaTools/zActionServer.h"
#include "search/Search.h"
#include "ship/BeyonceService.h"
#include "ship/ShipService.h"
#include "standing/Standing.h"
#include "standing/StandingMgr.h"
#include "station/HoloscreenMgrService.h"
#include "station/InsuranceService.h"
#include "station/JumpCloneService.h"
#include "station/RepairService.h"
#include "station/ReprocessingService.h"
#include "station/StationDataMgr.h"
#include "station/StationService.h"
#include "station/StationSvc.h"
#include "station/TradeService.h"
#include "system/BookmarkService.h"
#include "system/BubbleManager.h"
#include "system/KeeperService.h"
#include "system/ScenarioService.h"
#include "system/sov/SovereigntyMgrService.h"
#include "system/sov/SovereigntyDataMgr.h"
#include "system/WormholeSvc.h"
#include "system/cosmicMgrs/AnomalyMgr.h"
#include "system/cosmicMgrs/CivilianMgr.h"
#include "system/cosmicMgrs/DungeonMgr.h"
#include "system/cosmicMgrs/SpawnMgr.h"
#include "system/cosmicMgrs/WormholeMgr.h"
#include "DBCleaner.h"

Go to the source code of this file.

Functions

static void SetupSignals ()
 
static void CatchSignal (int sig_num)
 
int main (int argc, char *argv[])
 
static void CleanUp ()
 

Variables

static const char *const SRV_CONFIG_FILE = EVEMU_ROOT "/etc/eve-server.xml"
 
static volatile bool m_run = true
 

Function Documentation

static void CatchSignal ( int  sig_num)
static

Definition at line 1018 of file eve-server.cpp.

References m_run, sConfig, sLog, and EvE::traceStack().

Referenced by SetupSignals().

1019 {
1020  sLog.Error( " Signal System", "Caught signal: %d", sig_num );
1021  if (sConfig.debug.StackTrace)
1022  EvE::traceStack();
1023  //SafeSave();
1024  m_run = false;
1025  //CleanUp();
1026 }
#define sConfig
A macro for easier access to the singleton.
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
static volatile bool m_run
Definition: eve-server.cpp:191
void traceStack(void)
Definition: misc.cpp:169

Here is the call graph for this function:

Here is the caller graph for this function:

static void CleanUp ( )
static
Todo:
the thread system is only implemented for tcp connections at this time.

Definition at line 1028 of file eve-server.cpp.

References log_close_logfile(), sBubbleMgr, sBulkDB, sConsole, sDatabase, sDataMgr, sEntityList, ServiceDB::SetServerOnlineStatus(), sImageServer, sItemFactory, sLog, sMktMgr, sStandingMgr, sStatMgr, stDataMgr, and sThread.

1028  {
1029  sLog.Warning(" ServerShutdown", "Main loop has stopped." );
1030  sLog.Error(" ServerShutdown", "EVEmu Server is Offline." );
1031  if (!sConsole.IsDbError())
1033  /* stop TCP listener */
1034  //tcps.Close();
1035  sLog.Warning(" ServerShutdown", "TCP listener stopped." );
1036  /* stop Image Server */
1037  sImageServer.Stop();
1038  sLog.Warning(" ServerShutdown", "Image Server stopped." );
1039  /* Close the MarketMgr */
1040  sLog.Warning(" ServerShutdown", "Shutting down Market Manager." );
1041  sMktMgr.Close();
1042  /* Close the bulk data manager */
1043  sLog.Warning(" ServerShutdown", "Closing the BulkData Manager." );
1044  sBulkDB.Close();
1045  /* Close the station data manager */
1046  sLog.Warning(" ServerShutdown", "Closing the StationData Manager." );
1047  stDataMgr.Close();
1048  /* Close the static data manager */
1049  sLog.Warning(" ServerShutdown", "Closing the StaticData Manager." );
1050  sDataMgr.Close();
1051  sStatMgr.Close();
1052  sStandingMgr.Close();
1053  sLog.Warning(" ServerShutdown", "Saving Items." );
1054  if (!sConsole.IsDbError())
1055  sItemFactory.SaveItems();
1056  /* Close the entity list */
1057  sLog.Warning(" ServerShutdown", "Closing the Entity List." );
1058  sEntityList.Close();
1059  /* Close the service manager */
1060  sLog.Warning(" ServerShutdown", "Closing the Services Manager." );
1061  //pyServMgr.Close();
1062  /* Shut down the Item system */
1063  sLog.Warning(" ServerShutdown", "Shutting down Item Factory." );
1064  sItemFactory.Close();
1065  sLog.Warning(" ServerShutdown", "Closing the Bubble Manager." );
1066  sBubbleMgr.clear();
1067  /* Close the command dispatcher */
1068  //command_dispatcher.Close();
1069  /* Stop Console Command Interpreter */
1070  //sConsole.Stop();
1071  /* close the db handler */
1072  sLog.Warning(" ServerShutdown", "Closing DataBase Connection." );
1073  sDatabase.Close();
1075  sLog.Warning(" ServerShutdown", "Shutting down Thread Manager." );
1076  /* join open threads */
1077  sThread.EndThreads();
1078  sLog.Warning(" ServerShutdown", "EVEmu is Offline.");
1079  /* close logfile */
1081 }
#define sStatMgr
Definition: StatisticMgr.h:68
#define sDatabase
Definition: dbcore.h:199
#define stDataMgr
#define sConsole
#define sImageServer
Definition: ImageServer.h:93
#define sEntityList
Definition: EntityList.h:208
#define sStandingMgr
Definition: StandingMgr.h:52
#define sThread
Definition: Threading.h:50
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
#define sBulkDB
Definition: BulkDB.h:54
#define sMktMgr
Definition: MarketMgr.h:86
static void SetServerOnlineStatus(bool online=false)
Definition: ServiceDB.cpp:186
#define sItemFactory
Definition: ItemFactory.h:165
#define sBubbleMgr
bool log_close_logfile()
Definition: logsys.cpp:160
#define sDataMgr

Here is the call graph for this function:

int main ( int  argc,
char *  argv[] 
)
Note
this is NOT used correctly yet...
Todo:
update this to have a ShutDown() method, with these items. also look into calling it when a signal is caught, for cleanup.
Note
these are order-dependent...
Todo:
the thread system is only implemented for tcp connections at this time.

Definition at line 193 of file eve-server.cpp.

References PyServiceMgr::cache_service, Civilian_AI_Version, CommandDispatcher::Close(), PyServiceMgr::Close(), BaseTCPServer::Close(), Config_Version, DBcore::Connected, currentDateTime(), dbClean, Drone_AI_Version, EVEBuildVersion, EVEMU_BUILD_DATE, EVEMU_REVISION, EVEProjectVersion, EVEVersionNumber, EVEDB::invTypes::FactoryService, GetTickCount(), GetTimeMSeconds(), PyServiceMgr::Initalize(), Joe_Version, load_log_settings(), log_close_logfile(), log_open_logfile(), Log_Version, PyServiceMgr::lsc_service, m_run, MachoNetVersion, Mission_Version, NPC_AI_Version, BaseTCPServer::Open(), TCPServer< X >::PopConnection(), POS_AI_Version, RegisterAllCommands(), PyServiceMgr::RegisterService(), EVEDB::invTypes::RepairService, EVEDB::invTypes::ReprocessingService, sBubbleMgr, sBulkDB, Scan_Version, sCivMgr, sConfig, sConsole, sDatabase, sDataMgr, sDunDataMgr, sEntityList, Sentry_AI_Version, Timer::SetCurrentTime(), ServiceDB::SetServerOnlineStatus(), SetupSignals(), sFltSvc, sFxDataMgr, sImageServer, sItemFactory, Sleep(), sLog, sMapData, sMissionDataMgr, sMktBotMgr, sMktMgr, sPIDataMgr, sPlanetDataMgr, sProfiler, SRV_CONFIG_FILE, sStandingMgr, sStatMgr, stDataMgr, sThread, svDataMgr, sWHMgr, MapDB::SystemStartup(), and TCPCONN_ERRBUF_SIZE.

194 {
195  double profileStartTime = GetTimeMSeconds();
196 
197  /* set current time for timer */
199 
200  /* init logging */
201  sLog.Initialize();
202 
203  sLog.Green(" ServerInit", "Loading Server Configuration Files.");
204  // should i try to load individual config files here? probably not, but would look cool. ;)
205  /* Load server configuration */
206  if (!sConfig.ParseFile(SRV_CONFIG_FILE)) {
207  sLog.Error( " ServerInit", "ERROR: Loading server configuration '%s' failed.", SRV_CONFIG_FILE );
208  std::cout << std::endl << "press any key to exit..."; std::cin.get();
209  return EXIT_FAILURE;
210  }
211 
212  std::printf("\n"); // spacer
213  /* display server config data */
214  sLog.Log(" Supported Client", " %s", EVEProjectVersion);
215  sLog.Log(" Client Version", " %.2f", EVEVersionNumber);
216  sLog.Log(" Client Build", " %d", EVEBuildVersion);
217  sLog.Log(" MachoNet", " %u", MachoNetVersion);
218  sLog.Log(" Server Revision", " %s", EVEMU_REVISION );
219  sLog.Log(" Build Date", " %s", EVEMU_BUILD_DATE );
220  sLog.Log(" Config Version", " %.1f", Config_Version );
221  sLog.Log(" Log Version", " %.1f", Log_Version );
222  sLog.Log("TraderJoe Version", " %.2f", Joe_Version );
223  sLog.Log(" Missions Version", " %.2f", Mission_Version );
224  sLog.Log(" Scan Version", " %.2f", Scan_Version );
225  sLog.Log(" NPC AI Version", " %.2f", NPC_AI_Version );
226  sLog.Log(" Drone AI Version", " %.2f", Drone_AI_Version );
227  sLog.Log(" Civ AI Version", " %.2f", Civilian_AI_Version );
228  sLog.Log("Sentry AI Version", " %.2f", Sentry_AI_Version );
229  sLog.Log(" POS AI Version", " %.2f", POS_AI_Version );
230  std::printf("\n"); // spacer
231 
232  /* Load server log settings */
233  if (load_log_settings(sConfig.files.logSettings.c_str())) {
234  sLog.Green( " ServerInit", "Log settings loaded from %s", sConfig.files.logSettings.c_str() );
235  } else {
236  sLog.Warning( " ServerInit", "Unable to read %s (this file is optional)", sConfig.files.logSettings.c_str() );
237  }
238 
239  /* open up the log file if specified */
240  if (!sConfig.files.logDir.empty()) {
241  //sLog.InitializeLogging(sConfig.files.logDir);
242  std::string logFile = sConfig.files.logDir + "eve-server.log";
243  if( log_open_logfile( logFile.c_str() ) ) {
244  sLog.Green( " ServerInit", "Found log directory %s", sConfig.files.logDir.c_str() );
245  } else {
246  sLog.Warning( " ServerInit", "Unable to find log directory '%s', only logging to the screen now.", sConfig.files.logDir.c_str() );
247  }
248  }
249  std::printf("\n"); // spacer
250 
251  sLog.Green(" ServerInit", "Server Configuration Files Loaded.");
252  std::printf("\n"); // spacer
253 
254  sLog.Blue(" ServerConfig", "Main Loop Settings");
255  uint8 m_sleepTime = sConfig.server.ServerSleepTime; // default 10ms. max 256ms
256  if (m_sleepTime == 10) {
257  sLog.Green(" Loop Sleep Time","Default at 10ms.");
258  } else {
259  sLog.Error(" Loop Sleep Time","**Be Careful With This Setting!**");
260  sLog.Warning(" Loop Sleep Time","Changed from default 10ms to %ums.", m_sleepTime);
261  }
262  /* removed code for this 25 March 2020
263  uint16 m_idle = sConfig.server.idleSleepTime; // default 1s. max 65.535s
264  if (m_idle == 1000)
265  sLog.Green(" Idle Sleep Time","Default at 1000ms.");
266  else {
267  sLog.Error(" Loop Sleep Time","**Be Careful With This Setting!**");
268  sLog.Yellow(" Idle Sleep Time","Changed from default 1000ms to %ums.", m_idle);
269  } */
270  std::printf("\n"); // spacer
271 
272  /* Custom config file options
273  * current settings displayed on console at start-up
274  * -allan 7June2015
275  */
276  sLog.Blue(" ServerConfig", "World Switches");
277  if (sConfig.world.saveOnMove) {
278  sLog.Green(" Save on Move","Enabled.");
279  } else {
280  sLog.Warning(" Save on Move","Disabled.");
281  }
282  if (sConfig.world.saveOnUpdate) {
283  sLog.Green(" Save on Update","Enabled.");
284  } else {
285  sLog.Warning(" Save on Update","Disabled.");
286  }
287  if (sConfig.world.StationDockDelay) {
288  sLog.Green(" Docking Delay","Enabled.");
289  } else {
290  sLog.Warning(" Docking Delay","Disabled.");
291  }
292  if (sConfig.world.gridUnload) {
293  sLog.Green(" Grid Unloading","Enabled. Grids will unload after %u seconds of inactivity.", sConfig.world.gridUnloadTime);
294  } else {
295  sLog.Warning(" Grid Unloading","Disabled.");
296  }
297  std::printf("\n"); // spacer
298 
299  sLog.Blue(" ServerConfig", "Rate Modifiers");
300  if (sConfig.rates.secRate != 1.0) {
301  sLog.Yellow(" SecStatus","Modified at %.0f%%.", (sConfig.rates.secRate *100) );
302  } else {
303  sLog.Green(" SecStatus","Normal.");
304  }
305  if (sConfig.rates.npcBountyMultiply != 1.0) {
306  sLog.Yellow(" Bountys","Modified at %.0f%%.", (sConfig.rates.npcBountyMultiply *100) );
307  } else {
308  sLog.Green(" Bountys","Normal.");
309  }
310  if (sConfig.rates.DropItem != 1) {
311  sLog.Yellow(" Item Drops","Modified at %ux.", sConfig.rates.DropItem );
312  } else {
313  sLog.Green(" Item Drops","Normal.");
314  }
315  if (sConfig.rates.DropSalvage != 1) {
316  sLog.Yellow(" Salvage Drops","Modified at %ux.", sConfig.rates.DropSalvage );
317  } else {
318  sLog.Green(" Salvage Drops","Normal.");
319  }
320  if (sConfig.rates.DropMoney != 1.0) {
321  sLog.Yellow(" Isk Rewards","Modified at %.0f%%.", (sConfig.rates.DropMoney *100) );
322  } else {
323  sLog.Green(" Isk Rewards","Normal.");
324  }
325  if (sConfig.rates.damageRate != 1.0) {
326  sLog.Yellow(" All Damages","Modified at %.0f%%.", (sConfig.rates.damageRate *100) );
327  } else {
328  sLog.Green(" All Damages","Normal.");
329  }
330  if (sConfig.rates.turretDamage != 1.0) {
331  sLog.Yellow(" Turret Dmg","Modified at %.0f%%.", (sConfig.rates.turretDamage *100) );
332  } else {
333  sLog.Green(" Turret Dmg","Normal.");
334  }
335  if (sConfig.rates.turretRoF != 1.0) {
336  sLog.Yellow(" Turret ROF","Modified at %.0f%%.", (sConfig.rates.turretRoF *100) );
337  } else {
338  sLog.Green(" Turret ROF","Normal.");
339  }
340  if (sConfig.rates.missileDamage != 1.0) {
341  sLog.Yellow(" Missile Dmg","Modified at %.0f%%.", (sConfig.rates.missileDamage *100) );
342  } else {
343  sLog.Green(" Missile Dmg","Normal.");
344  }
345  if (sConfig.rates.missileRoF != 1.0) {
346  sLog.Yellow(" Missile ROF","Modified at %.0f%%.", (sConfig.rates.missileRoF *100) );
347  } else {
348  sLog.Green(" Missile ROF","Normal.");
349  }
350  if (sConfig.rates.missileTime != 1.0) {
351  sLog.Yellow(" Missile Time","Modified at %.0f%%.", (sConfig.rates.missileTime *100) );
352  } else {
353  sLog.Green(" Missile Time","Normal.");
354  }
355  std::printf("\n"); // spacer
356  sLog.Blue(" ServerConfig", "R.A.M. Rate Modifiers");
357  if (sConfig.ram.ResPE != 1.0) {
358  sLog.Yellow(" PE Research Time","Modified at %.0f%%.", (sConfig.ram.ResPE *100) );
359  } else {
360  sLog.Green(" PE Research Time","Normal.");
361  }
362  if (sConfig.ram.ResME != 1.0) {
363  sLog.Yellow(" ME Research Time","Modified at %.0f%%.", (sConfig.ram.ResME *100) );
364  } else {
365  sLog.Green(" ME Research Time","Normal.");
366  }
367  if (sConfig.ram.MatMod != 1.0) {
368  sLog.Yellow("Material Modifier","Modified at %.0f%%.", (sConfig.ram.MatMod *100) );
369  } else {
370  sLog.Green("Material Modifier","Normal.");
371  }
372  if (sConfig.ram.CopyTime != 1.0) {
373  sLog.Yellow(" Copy Time","Modified at %.0f%%.", (sConfig.ram.CopyTime *100) );
374  } else {
375  sLog.Green(" Copy Time","Normal.");
376  }
377  if (sConfig.ram.ProdTime != 1.0) {
378  sLog.Yellow(" Production Time","Modified at %.0f%%.", (sConfig.ram.ProdTime *100) );
379  } else {
380  sLog.Green(" Production Time","Normal.");
381  }
382  if (sConfig.ram.InventTime != 1.0) {
383  sLog.Yellow(" Invention Time","Modified at %.0f%%.", (sConfig.ram.InventTime *100) );
384  } else {
385  sLog.Green(" Invention Time","Normal.");
386  }
387  if (sConfig.ram.ReTime != 1.0) {
388  sLog.Yellow(" RE Time","Modified at %.0f%%.", (sConfig.ram.ReTime *100) );
389  } else {
390  sLog.Green(" RE Time","Normal.");
391  }
392  if (sConfig.ram.WasteMod != 1.0) {
393  sLog.Yellow(" Waste Modifier","Modified at %.0f%%.", (sConfig.ram.WasteMod *100) );
394  } else {
395  sLog.Green(" Waste Modifier","Normal.");
396  }
397  std::printf("\n"); // spacer
398 
399  sLog.Blue(" ServerConfig","Critical Hit Chances");
400  if (sConfig.rates.PlayerCritChance != 0.02f) {
401  sLog.Yellow(" Player","Modified at %.1f%%.", (sConfig.rates.PlayerCritChance *100) );
402  } else {
403  sLog.Green(" Player","Normal at 2%%.");
404  }
405  if (sConfig.rates.NpcCritChance != 0.015f) {
406  sLog.Yellow(" NPC","Modified at %.1f%%.", (sConfig.rates.NpcCritChance *100) );
407  } else {
408  sLog.Green(" NPC","Normal at 1.5%%.");
409  }
410  if (sConfig.rates.SentryCritChance != 0.02f) {
411  sLog.Yellow(" Sentry","Modified at %.1f%%.", (sConfig.rates.SentryCritChance *100) );
412  } else {
413  sLog.Green(" Sentry","Normal at 2%%.");
414  }
415  if (sConfig.rates.DroneCritChance != 0.03f) {
416  sLog.Yellow(" Drone","Modified at %.1f%%.", (sConfig.rates.DroneCritChance *100) );
417  } else {
418  sLog.Green(" Drone","Normal at 3%%.");
419  }
420  if (sConfig.rates.ConcordCritChance != 0.05f) {
421  sLog.Yellow(" Concord","Modified at %.1f%%.", (sConfig.rates.ConcordCritChance *100) );
422  } else {
423  sLog.Green(" Concord","Normal at 5%%.");
424  }
425  std::printf("\n"); // spacer
426 
427  sLog.Blue(" ServerConfig", "Feature Switches");
428  if (sConfig.ram.AutoEvent) {
429  sLog.Green(" RAM AutoEvent","Enabled.");
430  } else {
431  sLog.Warning(" RAM AutoEvent","Disabled.");
432  }
433  if (sConfig.server.ModuleAutoOff) {
434  sLog.Green(" Module Auto-Off","Enabled.");
435  } else {
436  sLog.Warning(" Module Auto-Off","Disabled.");
437  }
438  if (sConfig.server.AsteroidsOnDScan) {
439  sLog.Green(" DScan Asteroids","Enabled.");
440  } else {
441  sLog.Warning(" DScan Asteroids","Disabled.");
442  }
443  if (sConfig.server.CargoMassAdditive) {
444  sLog.Green(" Cargo Mass","Enabled.");
445  } else {
446  sLog.Warning(" Cargo Mass","Disabled.");
447  }
448  if (sConfig.cosmic.BumpEnabled) {
449  sLog.Green("Bumping Mechanics","Enabled.");
450  } else {
451  sLog.Warning("Bumping Mechanics","Disabled.");
452  }
453  if (sConfig.server.LoadOldMissions) {
454  sLog.Green("Keep Old Missions","Enabled.");
455  } else {
456  sLog.Warning("Keep Old Missions","Disabled.");
457  }
458  if (sConfig.testing.EnableDrones) {
459  sLog.Green(" Player Drones","Enabled.");
460  } else {
461  sLog.Warning(" Player Drones","Disabled.");
462  }
463  if (sConfig.testing.ShipHeat) {
464  sLog.Green(" Ship Heat","Enabled.");
465  } else {
466  sLog.Warning(" Ship Heat","Disabled.");
467  }
468  if (sConfig.cosmic.PIEnabled) {
469  sLog.Green(" PI System","Enabled.");
470  } else {
471  sLog.Warning(" PI System","Disabled.");
472  }
473  if (sConfig.cosmic.AnomalyEnabled) {
474  sLog.Green(" Anomaly System","Enabled.");
475  } else {
476  sLog.Warning(" Anomaly System","Disabled.");
477  }
478  if (sConfig.cosmic.DungeonEnabled) {
479  sLog.Green(" Dungeon System","Enabled.");
480  } else {
481  sLog.Warning(" Dungeon System","Disabled.");
482  }
483  if (sConfig.cosmic.BeltEnabled) {
484  sLog.Green(" Asteroid Belts","Enabled.");
485  } else {
486  sLog.Warning(" Asteroid Belts","Disabled.");
487  }
488  if (sConfig.npc.StaticSpawns) {
489  sLog.Green(" Static Spawns","Enabled. Checks every %u minutes", sConfig.npc.StaticTimer /60);
490  } else {
491  sLog.Warning(" Static Spawns","Disabled.");
492  }
493  if (sConfig.npc.RoamingSpawns) {
494  sLog.Green(" Roaming Spawns","Enabled. Checks every %u minutes", sConfig.npc.RoamingTimer /60);
495  } else {
496  sLog.Warning(" Roaming Spawns","Disabled.");
497  }
498  if (sConfig.npc.RoamingSpawns or sConfig.npc.StaticSpawns)
499  sLog.Green(" Spawns Enabled","Respawn timer checks every %u minutes", sConfig.npc.RespawnTimer /60);
500  if (sConfig.server.BountyPayoutDelayed) {
501  sLog.Green(" Delayed Bounties","Delayed Bounties are Enabled. Loop runs every %u minutes", sConfig.server.BountyPayoutTimer);
502  if (sConfig.server.FleetShareDelayed) {
503  sLog.Green(" Delayed Bounties","Delay for Fleet Bounty Sharing is Enabled.");
504  } else {
505  sLog.Warning(" Delayed Bounties","Delay for Fleet Bounty Sharing is Disabled. Fleet Sharing of Bounties is immediate.");
506  }
507  } else {
508  sLog.Warning(" Delayed Bounties","Delayed Bounties are Disabled. Bounty payouts are immediate.");
509  if (sConfig.server.FleetShareDelayed) {
510  sLog.Warning(" Delayed Bounties","Delayed Bounties are Disabled. Fleet Sharing of Bounties is immediate.");
511  } else {
512  sLog.Warning(" Delayed Bounties","Delay for Fleet Bounty Sharing is Disabled. Fleet Sharing of Bounties is immediate.");
513  }
514  }
515  std::printf("\n"); // spacer
516 
517  sLog.Blue(" ServerConfig", "Misc Switches");
518  if (sConfig.server.ModuleDamageChance) {
519  sLog.Green(" Module Damage","Enabled. Set to %i%% chance.", (int8)(sConfig.server.ModuleDamageChance *100));
520  } else {
521  sLog.Warning(" Module Damage","Disabled.");
522  }
523  if (sConfig.rates.WorldDecay) {
524  sLog.Green(" Decay Timer","Enabled. Checks every %u minutes", sConfig.rates.WorldDecay);
525  } else {
526  sLog.Warning(" Decay Timer","Disabled.");
527  }
528  if (sConfig.server.TraderJoe) {
529  sLog.Green(" Market Bot Mgr", "TraderJoe is Enabled.");
530  /* create the MarketBot singleton */
531  sLog.Green(" ServerInit", "Starting Market Bot Manager");
532  sMktBotMgr.Initialize();
533  } else {
534  sLog.Warning(" Market Bot Mgr", "TraderJoe is Disabled.");
535  }
536  std::printf("\n"); // spacer
537 
538  sLog.Blue(" ServerConfig", "Debug Switches");
539  if (sConfig.debug.IsTestServer) {
540  sLog.Error(" ServerConfig", "Test Server Enabled");
541  } else {
542  sLog.Error(" ServerConfig", "Live Server Enabled");
543  }
544  if (sConfig.debug.StackTrace) {
545  sLog.Warning(" StackTrace", "Enabled");
546  } else {
547  sLog.Warning(" StackTrace", "Disabled");
548  }
549  if (sConfig.debug.UseProfiling) {
550  sLog.Green(" Server Profiling","Enabled.");
551  sProfiler.Initialize();
552  } else {
553  sLog.Warning(" Server Profiling","Disabled.");
554  }
555  if (sConfig.debug.BeanCount) {
556  sLog.Green(" BeanCounting","Enabled.");
557  } else {
558  sLog.Warning(" BeanCounting","Disabled.");
559  }
560  if (sConfig.debug.SpawnTest) {
561  sLog.Warning(" Spawn Test","Enabled.");
562  } else {
563  sLog.Warning(" Spawn Test","Disabled.");
564  }
565  if (sConfig.debug.BubbleTrack) {
566  sLog.Warning(" Bubble Tracking","Enabled.");
567  } else {
568  sLog.Warning(" Bubble Tracking","Disabled.");
569  }
570  if (sConfig.debug.UseShipTracking) {
571  sLog.Warning(" Ship Tracking","Enabled.");
572  } else {
573  sLog.Warning(" Ship Tracking","Disabled.");
574  }
575  if (sConfig.debug.PositionHack) {
576  sLog.Warning(" Position Hack","Enabled.");
577  } else {
578  sLog.Warning(" Position Hack","Disabled.");
579  }
580  std::printf("\n"); // spacer
581 
582  /* Start up the TCP server */
583  EVETCPServer tcps;
584  char errbuf[ TCPCONN_ERRBUF_SIZE ];
585  sLog.Green( " ServerInit", "Starting TCP Server");
586  if (tcps.Open(sConfig.net.port, errbuf)) {
587  sLog.Blue( " BaseTCPServer", "TCP Server started on port %u.", sConfig.net.port );
588  } else {
589  sLog.Error( " BaseTCPServer", "Error starting TCP Server: %s.", errbuf );
590  std::cout << std::endl << "press any key to exit..."; std::cin.get();
591  return EXIT_FAILURE;
592  }
593  std::printf("\n"); // spacer
594  Sleep(250);
595 
596  /* connect to the database */
597  sLog.Green(" ServerInit", "Connecting to DataBase");
598  sDatabase.Initialize(sConfig.database.host,
599  sConfig.database.username,
600  sConfig.database.password,
601  sConfig.database.db,
602  sConfig.database.compress,
603  sConfig.database.ssl,
604  sConfig.database.port,
605  sConfig.database.useSocket,
606  sConfig.database.autoReconnect,
607  sConfig.debug.UseProfiling
608  );
609  if (sDatabase.GetStatus() != DBcore::Connected) {
610  // error msg printed in DBcore::Initalize routine
611  std::cout << std::endl << "press any key to exit..."; std::cin.get();
612  return EXIT_FAILURE;
613  }
614  std::printf("\n"); // spacer
615 
616  // Clean DB upon initialisation
617  dbClean.Initialize();
618  std::printf("\n");
619 
620  // start up the image server
621  sLog.Green(" ServerInit", "Starting Image Server");
622  sImageServer.Run();
623  // this gives the imageserver's server time to load so the dynamic database msgs are in order
624  Sleep(250);
625 
626  sThread.Initialize();
627  sLog.Green( " Threading", "Starting Main Loop thread with ID 0x%X", pthread_self() );
628  //sThread.AddThread(pthread_self());
629  std::printf("\n"); // spacer
630 
631  // basic shit done. begin loading server specifics...
632  sLog.Green(" ServerInit", "Loading server");
633  std::printf("\n"); // spacer
634 
635  /* create a single item factory */
636  sLog.Green(" ServerInit", "Starting Item Factory");
637  sItemFactory.Initialize();
638  /* initialize EntityList singleton, clientID seed and start tic timer */
639  sLog.Green(" ServerInit", "Starting Entity List");
640  sEntityList.Initialize();
641  /* create a service manager */
642  sLog.Green(" ServerInit", "Starting Service Manager");
643  PyServiceMgr pyServMgr( 888444, sEntityList );
644  sLog.Blue(" Service Manager", "Service Manager Initialized.");
645  /* create a command dispatcher */
646  sLog.Green(" ServerInit", "Starting Command Dispatch Manager");
647  CommandDispatcher command_dispatcher( pyServMgr );
648  RegisterAllCommands( command_dispatcher );
649  sLog.Blue(" Command Dispatch", "Command Dispatcher Initialized.");
650  /* create the BubbleManager singleton */
651  sLog.Green(" ServerInit", "Starting Bubble Manager");
652  sBubbleMgr.Initialize();
653  /* create the StandingMgr singleton */
654  sLog.Green(" ServerInit", "Starting Standings Manager");
655  sStandingMgr.Initialize();
656  /* create the FleetService singleton */
657  sLog.Green(" ServerInit", "Starting Fleet Services");
658  sFltSvc.Initialize(&pyServMgr);
659  /* create the MarketMgr singleton */
660  sLog.Green(" ServerInit", "Starting Market Manager");
661  sMktMgr.Initialize(&pyServMgr);
662  sLog.Green(" ServerInit", "Starting Statistics Manager");
663  sStatMgr.Initialize();
664  /* create console command interperter singleton */
665  sLog.Green(" ServerInit", "Starting Console Manager");
666  sConsole.Initialize(&command_dispatcher);
667  std::printf("\n"); // spacer
668 
669  sLog.Blue(" ServerConfig", "Cosmic Manager Settings");
670  if (sConfig.cosmic.CiviliansEnabled) {
671  sLog.Green(" Civilian Manager", "Civilian Manager Enabled.");
672  /* create the CivilianMgr singleton */
673  sLog.Green(" ServerInit", "Starting Civilian Manager");
674  sCivMgr.Initialize(&pyServMgr);
675  } else {
676  sLog.Warning(" Civilian Manager", "Civilian Manager Disabled.");
677  }
678  if (sConfig.cosmic.WormHoleEnabled) {
679  sLog.Green(" Wormhole Manager", "Wormhole Manager Enabled.");
680  /* create the WormholeMgr singleton */
681  sLog.Green(" ServerInit", "Starting Wormhole Manager");
682  sWHMgr.Initialize(&pyServMgr);
683  } else {
684  sLog.Warning(" Wormhole Manager", "Wormhole Manager Disabled.");
685  }
686  std::printf("\n"); // spacer
687 
688  /* Service creation and registration. */
689  sLog.Green(" ServerInit", "Registering Service Managers."); // 90 currently known pyServMgr
690  double startTime = GetTimeMSeconds();
691  /* Please keep the pyServMgr list clean so it's easier to find things */
692  /* 'services' here are systems that respond to client calls */
693  // move this into a service Init() function? will need more work to do...
694  pyServMgr.RegisterService("account", new AccountService(&pyServMgr));
695  pyServMgr.RegisterService("agentMgr", new AgentMgrService(&pyServMgr));
696  pyServMgr.RegisterService("aggressionMgr", new AggressionMgrService(&pyServMgr));
697  pyServMgr.RegisterService("alert", new AlertService(&pyServMgr));
698  pyServMgr.RegisterService("allianceRegistry", new AllianceRegistry(&pyServMgr));
699  pyServMgr.RegisterService("authentication", new AuthService(&pyServMgr));
700  pyServMgr.RegisterService("billMgr", new BillMgr(&pyServMgr));
701  pyServMgr.RegisterService("beyonce", new BeyonceService(&pyServMgr));
702  pyServMgr.RegisterService("bookmark", new BookmarkService(&pyServMgr));
703  pyServMgr.RegisterService("browserLockdownSvc", new BrowserLockdownService(&pyServMgr));
704  pyServMgr.RegisterService("bulkMgr", new BulkMgrService(&pyServMgr));
705  pyServMgr.RegisterService("calendarProxy", new CalendarProxy(&pyServMgr));
706  pyServMgr.RegisterService("calendarMgr", new CalendarMgrService(&pyServMgr));
707  pyServMgr.RegisterService("certificateMgr", new CertificateMgrService(&pyServMgr));
708  pyServMgr.RegisterService("charFittingMgr", new CharFittingMgr(&pyServMgr));
709  pyServMgr.RegisterService("charUnboundMgr", new CharUnboundMgrService(&pyServMgr));
710  pyServMgr.RegisterService("charMgr", new CharMgrService(&pyServMgr));
711  pyServMgr.RegisterService("clientStatLogger", new ClientStatLogger(&pyServMgr));
712  pyServMgr.RegisterService("clientStatsMgr", new ClientStatsMgr(&pyServMgr));
713  pyServMgr.RegisterService("config", new ConfigService(&pyServMgr));
714  pyServMgr.RegisterService("corpBookmarkMgr", new CorpBookmarkMgr(&pyServMgr));
715  pyServMgr.RegisterService("corpFittingMgr", new CorpFittingMgr(&pyServMgr));
716  pyServMgr.RegisterService("corpmgr", new CorpMgrService(&pyServMgr));
717  pyServMgr.RegisterService("corporationSvc", new CorporationService(&pyServMgr));
718  pyServMgr.RegisterService("corpRegistry", new CorpRegistryService(&pyServMgr));
719  pyServMgr.RegisterService("corpStationMgr", new CorpStationMgr(&pyServMgr));
720  pyServMgr.RegisterService("contractMgr", new ContractMgr(&pyServMgr));
721  pyServMgr.RegisterService("contractProxy", new ContractProxy(&pyServMgr));
722  pyServMgr.RegisterService("devToolsProvider", new DevToolsProviderService(&pyServMgr));
723  pyServMgr.RegisterService("dogmaIM", new DogmaIMService(&pyServMgr));
724  pyServMgr.RegisterService("dogma", new DogmaService(&pyServMgr));
725  pyServMgr.RegisterService("dungeonExplorationMgr", new DungeonExplorationMgrService(&pyServMgr));
726  pyServMgr.RegisterService("dungeon", new DungeonService(&pyServMgr));
727  pyServMgr.RegisterService("entity", new EntityService(&pyServMgr));
728  pyServMgr.RegisterService("facWarMgr", new FactionWarMgrService(&pyServMgr));
729  pyServMgr.RegisterService("factory", new FactoryService(&pyServMgr));
730  pyServMgr.RegisterService("fleetMgr", new FleetManager(&pyServMgr));
731  pyServMgr.RegisterService("fleetObjectHandler", new FleetObject(&pyServMgr));
732  pyServMgr.RegisterService("fleetProxy", new FleetProxy(&pyServMgr));
733  pyServMgr.RegisterService("holoscreenMgr", new HoloscreenMgrService(&pyServMgr));
734  pyServMgr.RegisterService("devIndexManager", new IndexManager(&pyServMgr));
735  pyServMgr.RegisterService("infoGatheringMgr", new InfoGatheringMgr(&pyServMgr));
736  pyServMgr.RegisterService("insuranceSvc", new InsuranceService(&pyServMgr));
737  pyServMgr.RegisterService("invbroker", new InvBrokerService(&pyServMgr));
738  pyServMgr.RegisterService("jumpCloneSvc", new JumpCloneService(&pyServMgr));
739  pyServMgr.RegisterService("keeper", new KeeperService(&pyServMgr));
740  pyServMgr.RegisterService("languageSvc", new LanguageService(&pyServMgr));
741  pyServMgr.RegisterService("localizationServer", new LocalizationServerService(&pyServMgr));
742  pyServMgr.RegisterService("lookupSvc", new LookupService(&pyServMgr));
743  pyServMgr.RegisterService("LPSvc", new LPService(&pyServMgr));
744  pyServMgr.RegisterService("storeServer", new LPStore(&pyServMgr));
745  pyServMgr.lsc_service = new LSCService(&pyServMgr, &command_dispatcher);
746  pyServMgr.RegisterService("LSC", pyServMgr.lsc_service);
747  pyServMgr.RegisterService("machoNet", new NetService(&pyServMgr));
748  pyServMgr.RegisterService("mailMgr", new MailMgrService(&pyServMgr));
749  pyServMgr.RegisterService("mailingListsMgr", new MailingListMgrService(&pyServMgr));
750  pyServMgr.RegisterService("map", new MapService(&pyServMgr));
751  pyServMgr.RegisterService("marketProxy", new MarketProxyService(&pyServMgr));
752  pyServMgr.RegisterService("missionMgr", new MissionMgrService(&pyServMgr));
753  pyServMgr.RegisterService("movementServer", new MovementService(&pyServMgr));
754  pyServMgr.RegisterService("notificationMgr", new NotificationMgrService(&pyServMgr));
755  pyServMgr.cache_service = new ObjCacheService(&pyServMgr, sConfig.files.cacheDir.c_str());
756  pyServMgr.RegisterService("objectCaching", pyServMgr.cache_service);
757  pyServMgr.RegisterService("onlineStatus", new OnlineStatusService(&pyServMgr));
758  pyServMgr.RegisterService("paperDollServer", new PaperDollService(&pyServMgr));
759  pyServMgr.RegisterService("petitioner", new PetitionerService(&pyServMgr));
760  pyServMgr.RegisterService("photoUploadSvc", new PhotoUploadService(&pyServMgr));
761  pyServMgr.RegisterService("planetMgr", new PlanetMgrService(&pyServMgr));
762  pyServMgr.RegisterService("planetOrbitalRegistryBroker", new PlanetORB(&pyServMgr));
763  pyServMgr.RegisterService("posMgr", new PosMgr(&pyServMgr));
764  pyServMgr.RegisterService("ramProxy", new RamProxyService(&pyServMgr));
765  pyServMgr.RegisterService("repairSvc", new RepairService(&pyServMgr));
766  pyServMgr.RegisterService("reprocessingSvc", new ReprocessingService(&pyServMgr));
767  pyServMgr.RegisterService("search", new Search(&pyServMgr));
768  pyServMgr.RegisterService("scanMgr", new ScanMgrService(&pyServMgr));
769  pyServMgr.RegisterService("ship", new ShipService(&pyServMgr));
770  pyServMgr.RegisterService("skillMgr", new SkillMgrService(&pyServMgr));
771  pyServMgr.RegisterService("slash", new SlashService(&pyServMgr, &command_dispatcher));
772  pyServMgr.RegisterService("sovMgr", new SovereigntyMgrService(&pyServMgr));
773  pyServMgr.RegisterService("standing2", new Standing(&pyServMgr));
774  pyServMgr.RegisterService("station", new StationService(&pyServMgr));
775  pyServMgr.RegisterService("stationSvc", new StationSvc(&pyServMgr));
776  pyServMgr.RegisterService("trademgr", new TradeService(&pyServMgr));
777  pyServMgr.RegisterService("tutorialSvc", new TutorialService(&pyServMgr));
778  pyServMgr.RegisterService("userSvc", new UserService(&pyServMgr));
779  pyServMgr.RegisterService("voiceMgr", new VoiceMgrService(&pyServMgr));
780  pyServMgr.RegisterService("voucher", new VoucherService(&pyServMgr));
781  pyServMgr.RegisterService("warRegistry", new WarRegistryService(&pyServMgr));
782  pyServMgr.RegisterService("wormholeMgr", new WormHoleSvc(&pyServMgr));
783  pyServMgr.RegisterService("encounterSpawnServer", new encounterSpawnServer(&pyServMgr));
784  pyServMgr.RegisterService("netStateServer", new netStateServer(&pyServMgr));
785  pyServMgr.RegisterService("zActionServer", new zActionServer(&pyServMgr));
786  pyServMgr.Initalize(startTime);
787  std::printf("\n"); // spacer
788 
789  // Create In-Memory Database Objects for Critical and High-Use Systems:
790  sLog.Yellow(" ServerInit", "Loading Static Database Table Objects...");
791  std::printf("\n"); // spacer
793  //sLog.Green(" ServerInit", "Priming cached objects.");
794  //pyServMgr.cache_service->PrimeCache();
795  sLog.Green(" ServerInit", "Initializing BulkData");
796  if (sConfig.server.BulkDataOD) {
797  sLog.Yellow(" BulkDataMgr", "PreLoading Disabled. BulkData will load on first call.");
798  } else {
799  sBulkDB.Initialize();
800  }
801  std::printf("\n"); // spacer
802 
803  sLog.Green(" ServerInit", "Loading Data Sets");
804  sDataMgr.Initialize();
805  std::printf("\n"); // spacer
806  sMissionDataMgr.Initialize();
807  std::printf("\n"); // spacer
808  sFxDataMgr.Initialize();
809  std::printf("\n"); // spacer
810  sMapData.Initialize();
811  std::printf("\n"); // spacer
812  sDunDataMgr.Initialize();
813  std::printf("\n"); // spacer
814  sPlanetDataMgr.Initialize();
815  std::printf("\n"); // spacer
816  sPIDataMgr.Initialize();
817  std::printf("\n"); // spacer
818  stDataMgr.Initialize();
819  std::printf("\n"); // spacer
820  svDataMgr.Initialize();
821  std::printf("\n"); // spacer
822 
823  // clear dynamic system data (player counts, etc) on server start
825  sLog.Green(" ServerInit", "Dynamic System Data Reset.");
826 
827  //sLog.Warning("server init", "Adding NPC Market Orders.");
828  //NPCMarket::CreateNPCMarketFromFile("/etc/npcMarket.xml");
829 
830  /* program events system */
831  SetupSignals();
832 
833  /*
834  #ifndef _WIN32 // Windows
835 
837  uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0);
838  bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false);
839 
840  if (affinity > 0) {
841  cpu_set_t mask;
842  CPU_ZERO(&mask);
843 
844  for (unsigned int i = 0; i < sizeof(affinity) * 8; ++i)
845  if (affinity & (1 << i))
846  CPU_SET(i, &mask);
847 
848  if (sched_setaffinity(0, sizeof(mask), &mask))
849  sLog->outError("Can't set used processors (hex): %x, error: %s", affinity, strerror(errno));
850  else {
851  CPU_ZERO(&mask);
852  sched_getaffinity(0, sizeof(mask), &mask);
853  sLog->outString("Using processors (bitmask, hex): %lx", *(__cpu_mask*)(&mask));
854  }
855  }
856 
857  if (highPriority) {
858  if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY))
859  sLog->outError("Can't set worldserver process priority class, error: %s", strerror(errno));
860  else
861  sLog->outString("worldserver process priority class set to %i", getpriority(PRIO_PROCESS, 0));
862  }
863 
864  #endif
865  */
866 
867  uint32 start(0);
868  EVETCPConnection* tcpc(nullptr);
869 
870  if (sConfig.debug.UseProfiling) {
871  // display startup data
872  sProfiler.PrintStartUpData();
873  // clear profile data from server startup
874  sProfiler.ClearAll();
875  sLog.Green(" Server Profiling","Profile Data Reset.");
876  }
877  std::printf("\n"); // spacer
878 
879  sLog.Blue(" ServerInit", "Server Initialized in %.3f Seconds.", (GetTimeMSeconds() - profileStartTime) / 1000);
880  sLog.Error(" ServerInit", "Main Loop Starting.");
881 
883  sLog.Green(" ServerInit", "EVEmu Server is Online.");
884 
885  sLog.Cyan(" Server", "Started on %s", currentDateTime().c_str());
886 
888  // !!! DO NOT PUT ANY INITIALIZATION CODE OR CALLS BELOW THIS LINE !!!
890 
891  /*
892  * THE MAIN LOOP
893  * Everything except IO should happen in this loop, in this thread context.
894  */
895  while (m_run) {
897  start = GetTickCount();
898 
899  /* Freeze Detector Code */
900  //++m_worldLoopCounter;
901 
902  if ((tcpc = tcps.PopConnection()))
903  sEntityList.Add(new Client(pyServMgr, &tcpc));
904 
905  sEntityList.Process();
906 
907  /* process console commands, if any, and check for 'exit' command */
908  m_run = sConsole.Process();
909 
910  /* do the stuff for thread sleeping */
911  start = GetTickCount() - start;
912  if (m_sleepTime > start)
913  std::this_thread::sleep_for(std::chrono::milliseconds(start));
914  }
915 
916  /*
917  * end of main loop
918  * at this point, server has been killed, and these are cleanup methods below here
919  */
920 
925  sLog.Warning(" ServerShutdown", "Main loop has stopped." );
926  sLog.Error(" ServerShutdown", "EVEmu Server is Offline." );
927  if (!sConsole.IsDbError())
929  /* stop TCP listener */
930  tcps.Close();
931  sLog.Warning(" ServerShutdown", "TCP listener stopped." );
932  /* stop Image Server */
933  sImageServer.Stop();
934  sLog.Warning(" ServerShutdown", "Image Server stopped." );
935  /* Close the MarketMgr */
936  sMktMgr.Close();
937  /* Close the bulk data manager */
938  sBulkDB.Close();
939  /* Close the station data manager */
940  stDataMgr.Close();
941  /* Close the map data manager */
942  sMapData.Close();
943  /* Close the static data manager */
944  sDataMgr.Close();
945  /* Close the statistics manager */
946  sStatMgr.Close();
947  /* Close the standings manager */
948  sStandingMgr.Close();
949  sLog.Warning(" ServerShutdown", "Saving Items." );
950  if (!sConsole.IsDbError())
951  sItemFactory.SaveItems();
952  /* Close the entity list */
953  sEntityList.Close();
954  /* Close the service manager */
955  pyServMgr.Close();
956  /* Shut down the Item system */
957  sLog.Warning(" ServerShutdown", "Shutting down Item Factory." );
958  sItemFactory.Close();
959  /* Close the bubble manager */
960  sBubbleMgr.clear();
961  /* Close the command dispatcher */
962  command_dispatcher.Close();
963  /* Stop Console Command Interpreter */
964  //sConsole.Stop();
965  /* close the db handler */
966  sLog.Warning(" ServerShutdown", "Closing DataBase Connection." );
967  sDatabase.Close();
969  sLog.Warning(" ServerShutdown", "Shutting down Thread Manager." );
970  /* join open threads */
971  sThread.EndThreads();
972  sLog.Warning(" ServerShutdown", "EVEmu is Offline.");
973  /* close logfile */
975  exit(EXIT_SUCCESS);
976 }
static const float POS_AI_Version
Definition: EVEVersion.h:56
#define sConfig
A macro for easier access to the singleton.
static const float Config_Version
Definition: EVEVersion.h:45
unsigned __int8 uint8
Definition: eve-compat.h:46
#define sStatMgr
Definition: StatisticMgr.h:68
#define sDatabase
Definition: dbcore.h:199
static const float Drone_AI_Version
Definition: EVEVersion.h:51
static const float Sentry_AI_Version
Definition: EVEVersion.h:55
#define stDataMgr
#define sConsole
#define sImageServer
Definition: ImageServer.h:93
static const float Scan_Version
Definition: EVEVersion.h:57
static const void SetCurrentTime()
Definition: timer.cpp:138
bool load_log_settings(const char *filename)
Definition: logsys.cpp:168
#define sPIDataMgr
Definition: PlanetDataMgr.h:79
#define sProfiler
Definition: dbcore.cpp:39
static const float Civilian_AI_Version
Definition: EVEVersion.h:54
bool log_open_logfile(const char *filename)
Definition: logsys.cpp:149
#define sEntityList
Definition: EntityList.h:208
#define sStandingMgr
Definition: StandingMgr.h:52
signed __int8 int8
Definition: eve-compat.h:45
static const uint16 MachoNetVersion
Definition: EVEVersion.h:33
#define sFltSvc
Definition: FleetService.h:147
#define sThread
Definition: Threading.h:50
static const uint32 TCPCONN_ERRBUF_SIZE
Definition: TCPConnection.h:34
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
static void SetupSignals()
Definition: eve-server.cpp:978
static const float Mission_Version
Definition: EVEVersion.h:52
#define sBulkDB
Definition: BulkDB.h:54
static const float Log_Version
Definition: EVEVersion.h:46
EVE derivation of TCP connection.
static const char *const EVEProjectVersion
Definition: EVEVersion.h:36
double GetTimeMSeconds()
Definition: utils_time.cpp:104
static void SystemStartup()
Definition: MapDB.cpp:201
static const double EVEVersionNumber
Definition: EVEVersion.h:32
const std::string currentDateTime()
Definition: utils_time.cpp:125
static const int32 EVEBuildVersion
Definition: EVEVersion.h:34
void Close()
Stops started listening.
Definition: TCPServer.cpp:118
#define sFxDataMgr
bool Open(uint16 port, char *errbuf=0)
Start listening on specified port.
Definition: TCPServer.cpp:61
Definition: PosMgr.h:16
static volatile bool m_run
Definition: eve-server.cpp:191
static const char *const SRV_CONFIG_FILE
Definition: eve-server.cpp:186
#define sMktBotMgr
Definition: MarketBotMgr.h:58
uint32 GetTickCount()
Definition: eve-compat.cpp:39
void RegisterAllCommands(CommandDispatcher &into)
Definition: AllCommands.cpp:31
X * PopConnection()
Pops connection from queue.
Definition: TCPServer.h:156
#define sMktMgr
Definition: MarketMgr.h:86
#define sMissionDataMgr
static const float Joe_Version
Definition: EVEVersion.h:48
Definition: Search.h:34
Definition: Client.h:66
unsigned __int32 uint32
Definition: eve-compat.h:50
Deals with character image stuff.
#define sDunDataMgr
Definition: DungeonMgr.h:78
#define sWHMgr
Definition: WormholeMgr.h:59
void Sleep(uint32 x)
Definition: eve-compat.cpp:32
Handles everything related to creating, deleting and selecting a character.
static const char *const EVEMU_REVISION
Definition: EVEVersion.h:42
static void SetServerOnlineStatus(bool online=false)
Definition: ServiceDB.cpp:186
#define sItemFactory
Definition: ItemFactory.h:165
static const char *const EVEMU_BUILD_DATE
Definition: EVEVersion.h:43
#define svDataMgr
#define sCivMgr
Definition: CivilianMgr.h:45
#define sBubbleMgr
bool log_close_logfile()
Definition: logsys.cpp:160
EVE derivation of TCP server.
Definition: EVETCPServer.h:36
#define dbClean
Definition: DBCleaner.h:29
#define sPlanetDataMgr
Definition: PlanetDataMgr.h:41
static const float NPC_AI_Version
Definition: EVEVersion.h:50
#define sDataMgr
#define sMapData
Definition: MapData.h:54

Here is the call graph for this function:

static void SetupSignals ( )
static

Definition at line 978 of file eve-server.cpp.

References CatchSignal().

Referenced by main().

979 {
980  /* setup sigaction to prevent zombies and catch other non-fatal signals */
981  struct sigaction sa;
982  sa.sa_handler = SIG_IGN;
983  sa.sa_flags = SA_NOCLDWAIT;
984  if (sigemptyset(&sa.sa_mask) == -1 ) { /* MT safe */
985  perror("SigEmptySet Failure");
986  exit(EXIT_FAILURE); /* NOT MT safe */
987  }
988  if (sigaction(SIGCHLD, &sa, nullptr) == -1) { /* MT safe */
989  perror("SigAction Failure");
990  exit(EXIT_FAILURE); /* NOT MT safe */
991  }
992  if (sigaction(SIGPIPE, &sa, nullptr) == -1) { /* MT safe */
993  // ignore broken pipe signal. db code will auto-recover.
994  perror("SigPipe Failure");
995  return;
996  }
997 
998  //::signal( SIGPIPE, SIG_IGN );
999  //::signal( SIGCHLD, SIG_IGN );
1000  ::signal( SIGINT, CatchSignal );
1001  ::signal( SIGTERM, CatchSignal );
1002  ::signal( SIGABRT, CatchSignal );
1003  //::signal( SIGSEGV, CatchSignal );
1004 
1005  #ifdef SIGABRT_COMPAT
1006  ::signal( SIGABRT_COMPAT, CatchSignal );
1007  #endif /* SIGABRT_COMPAT */
1008 
1009  #ifdef SIGBREAK
1010  ::signal( SIGBREAK, CatchSignal );
1011  #endif /* SIGBREAK */
1012 
1013  #ifdef SIGHUP
1014  ::signal( SIGHUP, CatchSignal );
1015  #endif /* SIGHUP */
1016 }
static void CatchSignal(int sig_num)

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

volatile bool m_run = true
static

Definition at line 191 of file eve-server.cpp.

Referenced by CatchSignal(), and main().

const char* const SRV_CONFIG_FILE = EVEMU_ROOT "/etc/eve-server.xml"
static

Definition at line 186 of file eve-server.cpp.

Referenced by main().