version 1.1.1.1.2.13, 2011/12/14 15:09:31
|
version 1.2, 2012/01/27 15:05:38
|
Line 11 sl_config cfg;
|
Line 11 sl_config cfg;
|
sessions_t Sessions; |
sessions_t Sessions; |
sched_root_task_t *root; |
sched_root_task_t *root; |
sqlite3 *acc, *pub; |
sqlite3 *acc, *pub; |
pthread_mutex_t mtx_sess; | pthread_mutex_t mtx_sess, mtx_pub; |
FILE *logg; |
FILE *logg; |
extern char compiled[], compiledby[], compilehost[]; |
extern char compiled[], compiledby[], compilehost[]; |
static char szCfgName[MAXPATHLEN]; |
static char szCfgName[MAXPATHLEN]; |
Line 51 sigHand(int sig)
|
Line 51 sigHand(int sig)
|
case SIGCHLD: |
case SIGCHLD: |
while (waitpid(-1, &stat, WNOHANG) > 0); |
while (waitpid(-1, &stat, WNOHANG) > 0); |
break; |
break; |
|
case SIGPIPE: |
|
break; |
} |
} |
} |
} |
|
|
Line 91 main(int argc, char **argv)
|
Line 93 main(int argc, char **argv)
|
return 1; |
return 1; |
} |
} |
pthread_mutex_init(&mtx_sess, NULL); |
pthread_mutex_init(&mtx_sess, NULL); |
|
pthread_mutex_init(&mtx_pub, NULL); |
openlog("mqttd", LOG_PID | LOG_CONS, LOG_DAEMON); |
openlog("mqttd", LOG_PID | LOG_CONS, LOG_DAEMON); |
for (i = 0; i < 3; i++) |
for (i = 0; i < 3; i++) |
if (!mqttLoadRTLM(&cfg, i)) { |
if (!mqttLoadRTLM(&cfg, i)) { |
Line 99 main(int argc, char **argv)
|
Line 102 main(int argc, char **argv)
|
mqttUnloadRTLM(i); |
mqttUnloadRTLM(i); |
UnloadConfig(&cfg); |
UnloadConfig(&cfg); |
closelog(); |
closelog(); |
|
pthread_mutex_destroy(&mtx_pub); |
pthread_mutex_destroy(&mtx_sess); |
pthread_mutex_destroy(&mtx_sess); |
return 2; |
return 2; |
} |
} |
Line 157 main(int argc, char **argv)
|
Line 161 main(int argc, char **argv)
|
sigaction(SIGHUP, &sa, NULL); |
sigaction(SIGHUP, &sa, NULL); |
sigaction(SIGTERM, &sa, NULL); |
sigaction(SIGTERM, &sa, NULL); |
sigaction(SIGCHLD, &sa, NULL); |
sigaction(SIGCHLD, &sa, NULL); |
|
sigaction(SIGPIPE, &sa, NULL); |
ioDEBUG(2, "Service is ready for start engine ..."); |
ioDEBUG(2, "Service is ready for start engine ..."); |
|
|
if ((sock = srv_Socket(&cfg)) == -1) { |
if ((sock = srv_Socket(&cfg)) == -1) { |
Line 190 end:
|
Line 195 end:
|
mqttUnloadRTLM(i); |
mqttUnloadRTLM(i); |
closelog(); |
closelog(); |
UnloadConfig(&cfg); |
UnloadConfig(&cfg); |
|
pthread_mutex_destroy(&mtx_pub); |
pthread_mutex_destroy(&mtx_sess); |
pthread_mutex_destroy(&mtx_sess); |
return ret; |
return ret; |
} |
} |