summaryrefslogtreecommitdiff
path: root/src/common/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/core.c')
-rw-r--r--src/common/core.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/common/core.c b/src/common/core.c
index 6a73d2d39..86634ec4b 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -8,17 +8,18 @@
#include "../common/strlib.h"
#include "core.h"
#include "../common/console.h"
+#include "../common/random.h"
#ifndef MINICORE
#include "../common/db.h"
#include "../common/socket.h"
#include "../common/timer.h"
#include "../common/thread.h"
- #include "../common/mempool.h"
#include "../common/sql.h"
#include "../config/core.h"
#include "../common/HPM.h"
#include "../common/utils.h"
+ #include "../common/conf.h"
#endif
#include <stdio.h>
@@ -52,7 +53,7 @@ char *SERVER_NAME = NULL;
#endif
#ifndef POSIX
-#define compat_signal(signo, func) signal(signo, func)
+#define compat_signal(signo, func) signal((signo), (func))
#else
sigfunc *compat_signal(int signo, sigfunc *func) {
struct sigaction sact, oact;
@@ -282,9 +283,11 @@ void core_defaults(void) {
strlib_defaults();
malloc_defaults();
#ifndef MINICORE
+ libconfig_defaults();
sql_defaults();
timer_defaults();
db_defaults();
+ socket_defaults();
#endif
}
/*======================================
@@ -302,10 +305,20 @@ int main (int argc, char **argv) {
arg_v = argv;
}
core_defaults();
+
+ {
+ int i;
+ for(i = 0; i < argc; i++) {
+ if( strcmp(argv[i], "--script-check") == 0 ) {
+ msg_silent = 0x7; // silence information and status messages
+ }
+ }
+ }
iMalloc->init();// needed for Show* in display_title() [FlavioJS]
-
- console->display_title();
+
+ if (!(msg_silent&0x1))
+ console->display_title();
#ifdef MINICORE // minimalist Core
usercheck();
@@ -317,7 +330,6 @@ int main (int argc, char **argv) {
Sql_Init();
rathread_init();
- mempool_init();
DB->init();
signals_init();
@@ -327,6 +339,10 @@ int main (int argc, char **argv) {
timer->init();
+ /* timer first */
+ rnd_init();
+ srand((unsigned int)timer->gettick());
+
console->init();
HCache->init();
@@ -335,14 +351,14 @@ int main (int argc, char **argv) {
HPM->init();
#endif
- socket_init();
+ sockt->init();
do_init(argc,argv);
{// Main runtime cycle
int next;
while (runflag != CORE_ST_STOP) {
- next = timer->do_timer(timer->gettick_nocache());
- do_sockets(next);
+ next = timer->perform(timer->gettick_nocache());
+ sockt->perform(next);
}
}
@@ -353,9 +369,8 @@ int main (int argc, char **argv) {
HPM->final();
#endif
timer->final();
- socket_final();
+ sockt->final();
DB->final();
- mempool_final();
rathread_final();
#endif