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.
This commit is contained in:
Jan Vidar Krey 2013-02-05 22:38:13 +01:00
parent 4f3c71234b
commit 4d438e1e90
1 changed files with 3 additions and 2 deletions

View File

@ -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);