/* inbound thread - enqueue inbound data to intermediate table */ static void *inbound_thread_main(void *arg) { while (stop == 0) { int rc; if (hup) nudge_queue(); do { rc = poll(pfd, pfd_cnt, 20000); /* 20 sec */ } while (rc < 0 && errno == EAGAIN && stop == 0); if (rc == 0) continue; /* Event readable... */ if (rc > 0) { /* Figure out the fd that is ready and call */ int i = 0; while (i < pfd_cnt) { if (pfd[i].revents & POLLIN) pfd_cb[i](pfd[i].fd); i++; } } } /* make sure event loop wakes up */ nudge_queue(); return NULL; }
/* * SIGHUP handler - re-read config, reconnect to ITDS */ static void hup_handler(int sig) { log_info("Got Hangup signal - flushing plugin configuration"); hup = 1; nudge_queue(); }
/* * SIGTERM handler */ static void term_handler(int sig) { log_info("Got Termination signal - shutting down plugin"); stop = 1; nudge_queue(); }