From: Guus Sliepen Date: Fri, 15 Jan 2010 22:41:14 +0000 (+0100) Subject: Optimise handling of select() returning <= 0. X-Git-Tag: release-1.0.12~11 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=b1945f70fe993ca447555a1e27f35638b0c1fd8b;p=tinc Optimise handling of select() returning <= 0. Before, we immediately retried select() if it returned -1 and errno is EAGAIN or EINTR, and if it returned 0 it would check for network events even if we know there are none. Now, if -1 or 0 is returned we skip checking network events, but we do check for timer and signal events. --- diff --git a/src/net.c b/src/net.c index 9b60a314..f24d18ad 100644 --- a/src/net.c +++ b/src/net.c @@ -374,11 +374,10 @@ int main_loop(void) { dump_connections(); return 1; } - - continue; } - check_network_activity(&readset, &writeset); + if(r > 0) + check_network_activity(&readset, &writeset); if(do_purge) { purge();