version 1.2.2.6, 2012/04/24 13:54:50
|
version 1.2.2.7, 2012/05/05 14:51:02
|
Line 12 sessions_t Sessions;
|
Line 12 sessions_t Sessions;
|
pubs_t Pubs; |
pubs_t Pubs; |
sched_root_task_t *root; |
sched_root_task_t *root; |
sqlite3 *acc, *pub; |
sqlite3 *acc, *pub; |
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 35 static void
|
Line 34 static void
|
sigHand(int sig) |
sigHand(int sig) |
{ |
{ |
int stat; |
int stat; |
struct tagSession *sess; |
|
|
|
switch (sig) { |
switch (sig) { |
case SIGHUP: |
case SIGHUP: |
Line 49 sigHand(int sig)
|
Line 47 sigHand(int sig)
|
case SIGTERM: |
case SIGTERM: |
ioDEBUG(1, "Terminate MQTT service in progress"); |
ioDEBUG(1, "Terminate MQTT service in progress"); |
Kill++; |
Kill++; |
|
|
SESS_LOCK; |
|
TAILQ_FOREACH(sess, &Sessions, sess_node) |
|
if (sess->sess_tid) |
|
pthread_cancel(sess->sess_tid); |
|
SESS_UNLOCK; |
|
break; |
break; |
case SIGCHLD: |
case SIGCHLD: |
while (waitpid(-1, &stat, WNOHANG) > 0); |
while (waitpid(-1, &stat, WNOHANG) > 0); |
Line 102 main(int argc, char **argv)
|
Line 94 main(int argc, char **argv)
|
printf("Error:: can't load #%d - %s\n", cfg_GetErrno(), cfg_GetError()); |
printf("Error:: can't load #%d - %s\n", cfg_GetErrno(), cfg_GetError()); |
return 1; |
return 1; |
} |
} |
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); |
/* load 3 plugins */ |
/* load 3 plugins */ |
for (i = 0; i < 3; i++) |
for (i = 0; i < 3; i++) |
Line 113 main(int argc, char **argv)
|
Line 103 main(int argc, char **argv)
|
mqttUnloadRTLM(i); |
mqttUnloadRTLM(i); |
cfgUnloadConfig(&cfg); |
cfgUnloadConfig(&cfg); |
closelog(); |
closelog(); |
pthread_mutex_destroy(&mtx_pub); |
|
pthread_mutex_destroy(&mtx_sess); |
|
return 2; |
return 2; |
} |
} |
acc = call.OpenACC(&cfg); |
acc = call.OpenACC(&cfg); |
Line 208 end: /* free all resources */
|
Line 196 end: /* free all resources */
|
mqttUnloadRTLM(i); |
mqttUnloadRTLM(i); |
closelog(); |
closelog(); |
cfgUnloadConfig(&cfg); |
cfgUnloadConfig(&cfg); |
pthread_mutex_destroy(&mtx_pub); |
|
pthread_mutex_destroy(&mtx_sess); |
|
return ret; |
return ret; |
} |
} |