aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/worker_util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-25 15:59:48 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-25 15:59:48 +0000
commitb7eec7adcde6199158f87d171a751ad59a6b4b0b (patch)
tree6219cf7ebf3245ae4a453c08aa547926307e6196 /src/libserver/worker_util.c
parent0599cdf4bbc8a38d159cff27195c71e27fb21000 (diff)
downloadrspamd-b7eec7adcde6199158f87d171a751ad59a6b4b0b.tar.gz
rspamd-b7eec7adcde6199158f87d171a751ad59a6b4b0b.zip
Do not enable accept event with no handler
Diffstat (limited to 'src/libserver/worker_util.c')
-rw-r--r--src/libserver/worker_util.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c
index b8b014a90..c40c4f73f 100644
--- a/src/libserver/worker_util.c
+++ b/src/libserver/worker_util.c
@@ -250,19 +250,21 @@ rspamd_prepare_worker (struct rspamd_worker *worker, const char *name,
rspamd_control_worker_add_default_handler (worker, ev_base);
/* Accept all sockets */
- cur = worker->cf->listen_socks;
- while (cur) {
- listen_socket = GPOINTER_TO_INT (cur->data);
- if (listen_socket != -1) {
- accept_event = g_slice_alloc0 (sizeof (struct event));
- event_set (accept_event, listen_socket, EV_READ | EV_PERSIST,
- accept_handler, worker);
- event_base_set (ev_base, accept_event);
- event_add (accept_event, NULL);
- worker->accept_events = g_list_prepend (worker->accept_events,
- accept_event);
+ if (accept_handler) {
+ cur = worker->cf->listen_socks;
+ while (cur) {
+ listen_socket = GPOINTER_TO_INT (cur->data);
+ if (listen_socket != -1) {
+ accept_event = g_slice_alloc0 (sizeof (struct event));
+ event_set (accept_event, listen_socket, EV_READ | EV_PERSIST,
+ accept_handler, worker);
+ event_base_set (ev_base, accept_event);
+ event_add (accept_event, NULL);
+ worker->accept_events = g_list_prepend (worker->accept_events,
+ accept_event);
+ }
+ cur = g_list_next (cur);
}
- cur = g_list_next (cur);
}
return ev_base;