Diff for /mqtt/src/mqttd.c between versions 1.1.1.1.2.8 and 1.1.1.1.2.12

version 1.1.1.1.2.8, 2011/12/01 08:15:25 version 1.1.1.1.2.12, 2011/12/14 12:45:30
Line 1 Line 1
 #include "global.h"  #include "global.h"
   #include "mqttd.h"
 #include "rtlm.h"  #include "rtlm.h"
 #include "utils.h"  #include "utils.h"
 #include "daemon.h"  #include "daemon.h"
   
   
 sl_config cfg;  sl_config cfg;
   sessions_t Sessions;
 sched_root_task_t *root;  sched_root_task_t *root;
   sqlite3 *acc, *pub;
   pthread_mutex_t mtx_sess;
   FILE *logg;
 extern char compiled[], compiledby[], compilehost[];  extern char compiled[], compiledby[], compilehost[];
 static char szCfgName[MAXPATHLEN];  static char szCfgName[MAXPATHLEN];
 int Verbose, Kill;  int Verbose, Kill;
Line 53  main(int argc, char **argv) Line 58  main(int argc, char **argv)
 {  {
         char ch, batch = 0, szStr[STRSIZ];          char ch, batch = 0, szStr[STRSIZ];
         register int i;          register int i;
         sqlite3 *acc = NULL, *pub = NULL;  
         FILE *logg = NULL;  
         int sock = -1, ret = 0;          int sock = -1, ret = 0;
         struct passwd *pass;          struct passwd *pass;
         struct sigaction sa;          struct sigaction sa;
   
           TAILQ_INIT(&Sessions);
   
         strlcpy(szCfgName, DEFAULT_CONFIG, sizeof szCfgName);          strlcpy(szCfgName, DEFAULT_CONFIG, sizeof szCfgName);
         while ((ch = getopt(argc, argv, "hvbc:")) != -1)          while ((ch = getopt(argc, argv, "hvbc:")) != -1)
                 switch (ch) {                  switch (ch) {
Line 83  main(int argc, char **argv) Line 88  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);
         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 91  main(int argc, char **argv) Line 97  main(int argc, char **argv)
                                 mqttUnloadRTLM(i);                                  mqttUnloadRTLM(i);
                         UnloadConfig(&cfg);                          UnloadConfig(&cfg);
                         closelog();                          closelog();
                           pthread_mutex_destroy(&mtx_sess);
                         return 2;                          return 2;
                 }                  }
         acc = call.OpenACC(&cfg);          acc = call.OpenACC(&cfg);
Line 183  end: Line 190  end:
                 mqttUnloadRTLM(i);                  mqttUnloadRTLM(i);
         closelog();          closelog();
         UnloadConfig(&cfg);          UnloadConfig(&cfg);
           pthread_mutex_destroy(&mtx_sess);
         return ret;          return ret;
 }  }

Removed from v.1.1.1.1.2.8  
changed lines
  Added in v.1.1.1.1.2.12


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>