Fix a deadlock
authorAlexander van Gessel <ai0867@gmail.com>
Tue, 24 Dec 2013 22:23:04 +0000 (23:23 +0100)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 25 Dec 2013 02:26:53 +0000 (21:26 -0500)
irkerd

diff --git a/irkerd b/irkerd
index f21f709e07296957b461ccd35deadde1d9c54d8e..b0bec84fbc9953d88b87c54f9fee6dc3db6a80c0 100755 (executable)
--- a/irkerd
+++ b/irkerd
@@ -127,6 +127,7 @@ class IRCClient():
         # Otherwise no other thread would ever be able to change
         # the shared state of an IRC object running this function.
         while True:
+            nextsleep = 0
             with self.mutex:
                 connected = [x for x in self.server_connections
                              if x is not None and x.socket is not None]
@@ -137,7 +138,8 @@ class IRCClient():
                     for s in insocks:
                         connmap[s.fileno()].consume()
                 else:
-                    time.sleep(timeout)
+                    nextsleep = timeout
+            time.sleep(nextsleep)
 
     def add_event_handler(self, event, handler):
         "Set a handler to be called later."