]> git.meshlink.io Git - meshlink/commitdiff
Optimise handling of select() returning <= 0.
authorGuus Sliepen <guus@tinc-vpn.org>
Fri, 15 Jan 2010 22:41:14 +0000 (23:41 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Fri, 15 Jan 2010 22:41:14 +0000 (23:41 +0100)
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.

src/net.c

index 9b60a31446143dd3cce7c0cafe4da41f6077cfb8..f24d18ad81db06d713b329a95180741b2d33c0fa 100644 (file)
--- 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();