- Added some tools to detect memory leaks.
[ircu2.10.12-pk.git] / ircd / ircd.c
index 3696538eaf0018f0296e7ac2c9e55a3bcbc0f0f1..87c171f7049d81ed1b3b2b6c9ffed392db316459 100644 (file)
@@ -75,6 +75,7 @@
  * External stuff
  *--------------------------------------------------------------------------*/
 extern void init_counters(void);
+extern void mem_dbg_initialise(void);
 
 /*----------------------------------------------------------------------------
  * Constants / Enums
@@ -229,7 +230,7 @@ static void try_connections(struct Event* ev) {
   struct ConnectionClass* cltmp;
   struct ConfItem*  con_conf    = 0;
   struct Jupe*      ajupe;
-  unsigned int      con_class   = 0;
+  const char*       con_class   = NULL;
 
   assert(ET_EXPIRE == ev_type(ev));
   assert(0 != ev_timer(ev));
@@ -238,7 +239,7 @@ static void try_connections(struct Event* ev) {
   Debug((DEBUG_NOTICE, "Connection check at   : %s", myctime(CurrentTime)));
   for (aconf = GlobalConfList; aconf; aconf = aconf->next) {
     /* Also when already connecting! (update holdtimes) --SRB */
-    if (!(aconf->status & CONF_SERVER) || aconf->port == 0)
+    if (!(aconf->status & CONF_SERVER) || aconf->port == 0 || aconf->hold == 0)
       continue;
 
     /* Also skip juped servers */
@@ -257,7 +258,10 @@ static void try_connections(struct Event* ev) {
 
     cltmp = aconf->conn_class;
     confrq = get_con_freq(cltmp);
-    aconf->hold = CurrentTime + confrq;
+    if(confrq == 0)
+      aconf->hold = next = 0;
+    else
+      aconf->hold = CurrentTime + confrq;
 
     /* Found a CONNECT config with port specified, scan clients and see if
      * this server is already connected?
@@ -265,7 +269,7 @@ static void try_connections(struct Event* ev) {
     cptr = FindServer(aconf->name);
 
     if (!cptr && (Links(cltmp) < MaxLinks(cltmp)) &&
-        (!connecting || (ConClass(cltmp) > con_class))) {
+        (!connecting /*|| (ConClass(cltmp) > con_class)*/)) {
       /*
        * Check connect rules to see if we're allowed to try
        */
@@ -437,7 +441,25 @@ static void parse_command_line(int argc, char** argv) {
     case 'd':  dpath      = optarg;                    break;
     case 'f':  configfile = optarg;                    break;
     case 'h':  ircd_strncpy(cli_name(&me), optarg, HOSTLEN); break;
-    case 'v':  printf("ircd %s\n", version);           exit(0);
+    case 'v':
+      printf("ircd %s\n", version);
+      printf("Event engines: ");
+#ifdef USE_KQUEUE
+      printf("kqueue() ");
+#endif
+#ifdef USE_DEVPOLL
+      printf("/dev/poll ");
+#endif
+#ifdef USE_POLL
+      printf("poll()");
+#else
+      printf("select()");
+#endif
+      printf("\nCompiled for a maximum of %d connections.\n", MAXCONNECTIONS);
+
+
+      exit(0);
+      break;
       
     case 'x':
       debuglevel = atoi(optarg);
@@ -551,6 +573,10 @@ int main(int argc, char **argv) {
   thisServer.uid  = getuid();
   thisServer.euid = geteuid();
 
+#ifdef MDEBUG
+  mem_dbg_initialise();
+#endif
+
 #if defined(HAVE_SETRLIMIT) && defined(RLIMIT_CORE)
   set_core_limit();
 #endif