MCPcopy Create free account
hub / github.com/assaultcube/AC / main

Function main

source/src/master.cpp:701–740  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

699}
700
701int main(int argc, char **argv)
702{
703 if(enet_initialize()<0) fatal("Unable to initialise network module");
704 atexit(enet_deinitialize);
705
706 const char *dir = "", *ip = AC_MASTER_URI;
707 int port = AC_MASTER_PORT;
708 if(argc>=2) dir = argv[1];
709 if(argc>=3 && argv[2][0]) port = atoi(argv[2]);
710 if(argc>=4) ip = argv[3][0] ? argv[3] : NULL;
711 defformatstring(logname)("%smaster.log", dir);
712 defformatstring(cfgname)("%smaster.cfg", dir);
713 path(logname);
714 path(cfgname);
715 logfile = fopen(logname, "a");
716 if(!logfile) logfile = stdout;
717 setvbuf(logfile, NULL, _IOLBF, 0);
718#ifndef WIN32
719 signal(SIGUSR1, reloadsignal);
720#endif
721 setupserver(port, ip);
722 for(;;)
723 {
724 if(reloadcfg)
725 {
726 conoutf("reloading master.cfg");
727 execfile(cfgname);
728 bangameservers();
729 banclients();
730 gengbanlist();
731 reloadcfg = false;
732 }
733
734 servtime = enet_time_get();
735 checkclients();
736 checkgameservers();
737 }
738
739 return EXIT_SUCCESS;
740}
741

Callers 1

svcmainMethod · 0.85

Calls 12

pathFunction · 0.85
setupserverFunction · 0.85
execfileFunction · 0.85
bangameserversFunction · 0.85
banclientsFunction · 0.85
gengbanlistFunction · 0.85
checkclientsFunction · 0.85
checkgameserversFunction · 0.85
fatalFunction · 0.70
conoutfFunction · 0.70
enet_initializeFunction · 0.50
enet_time_getFunction · 0.50

Tested by

no test coverage detected