From 4d438e1e901ee948a67d1d01fd923e1c16f6b2df Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Tue, 5 Feb 2013 22:38:13 +0100 Subject: [PATCH] Don't poll the connection monitor if there are no connections added. This caused the backends to return an error code, which in turn ended the mainloop. However, several other things also might occur in the main loop, such as DNS lookups which come prior to creating any connections that in turn would be monitored. --- src/network/backend.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/network/backend.c b/src/network/backend.c index 678ab9d..6061c69 100644 --- a/src/network/backend.c +++ b/src/network/backend.c @@ -132,10 +132,11 @@ struct timeout_queue* net_backend_get_timeout_queue() */ int net_backend_process() { - int res; + int res = 0; size_t secs = timeout_queue_get_next_timeout(&g_backend->timeout_queue, g_backend->now); - res = g_backend->handler.backend_poll(g_backend->data, secs * 1000); + if (g_backend->common.num) + res = g_backend->handler.backend_poll(g_backend->data, secs * 1000); g_backend->now = time(0); timeout_queue_process(&g_backend->timeout_queue, g_backend->now);