Use the host compiler for build tool c-ify.
[darkstat-debian] / darkstat.c
index c65631e..47a81ad 100644 (file)
@@ -153,7 +153,7 @@ unsigned int opt_hosts_keep = 500;
 static void cb_hosts_keep(const char *arg)
 { opt_hosts_keep = parsenum(arg, 0); }
 
-unsigned int opt_ports_max = 200;
+unsigned int opt_ports_max = 60;
 static void cb_ports_max(const char *arg)
 { opt_ports_max = parsenum(arg, 65536); }
 
@@ -412,7 +412,10 @@ main(int argc, char **argv)
    daemonize_finish();
 
    while (running) {
-      int select_ret, max_fd = -1, use_timeout = 0;
+      int select_ret;
+      int max_fd = -1;
+      int use_timeout = 0;
+      int cap_ret;
       struct timeval timeout;
       struct timespec t;
       fd_set rs, ws;
@@ -451,10 +454,14 @@ main(int argc, char **argv)
       }
 
       graph_rotate();
-      cap_poll(&rs);
+      cap_ret = cap_poll(&rs);
       dns_poll();
       http_poll(&rs, &ws);
       timer_stop(&t, 1000000000, "event processing took longer than a second");
+
+      if (!cap_ret) {
+         running = 0;
+      }
    }
 
    verbosef("shutting down");