diff options
Diffstat (limited to 'src/net.c')
-rw-r--r-- | src/net.c | 43 |
1 files changed, 7 insertions, 36 deletions
@@ -129,28 +129,12 @@ handle_connection(FILE * in, FILE * out) } if (spool) - job_schedule_spool(spool); + scan_spool(spool); else - job_schedule_all(); + scan_all_spools(); free(buf); } -int reconfigure; -static int terminate; - -RETSIGTYPE -sig_hup(int sig) -{ - reconfigure = 1; - terminate = 1; -} - -RETSIGTYPE -sig_term(int sig) -{ - terminate = 1; -} - static inline int notify_parent(void) { @@ -158,8 +142,8 @@ notify_parent(void) return (p && strcmp(p, "1") == 0); } -void -wydawca_listener(void) +void * +wy_thr_listen(void *ptr) { int ctlfd = open_listener(); int wfd = watcher_init(); @@ -181,16 +165,9 @@ wydawca_listener(void) if (notify_parent()) kill(getppid(), SIGUSR1); - signal(SIGHUP, sig_hup); - signal(SIGTERM, sig_term); - signal(SIGQUIT, sig_term); - signal(SIGINT, sig_term); - while (!terminate) { + while (1) { int rc; fd_set rset; - struct timeval to, *pto; - - job_queue_runner(triplet_sweep()); FD_ZERO(&rset); if (ctlfd != -1) @@ -198,14 +175,7 @@ wydawca_listener(void) if (wfd != -1) FD_SET(wfd, &rset); - if (wakeup_interval) { - to.tv_sec = wakeup_interval; - to.tv_usec = 0; - *pto = to; - } else - pto = NULL; - - rc = select(maxfd + 1, &rset, NULL, NULL, pto); + rc = select(maxfd + 1, &rset, NULL, NULL, NULL); if (rc == 0) continue; else if (rc < 0) { @@ -250,4 +220,5 @@ wydawca_listener(void) fclose(out); } } + return NULL; } |