Another anti-buzz delay. 1.1
authorEric S. Raymond <esr@thyrsus.com>
Fri, 28 Sep 2012 20:35:14 +0000 (16:35 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 28 Sep 2012 20:35:14 +0000 (16:35 -0400)
irkerd

diff --git a/irkerd b/irkerd
index 905c12d850458116b54f533b267e41217a272737..b5d897de54eba1149fc124f76d80cbe2c5ddc0d6 100755 (executable)
--- a/irkerd
+++ b/irkerd
@@ -34,7 +34,7 @@ DISCONNECT_TTL = (24 * 60 * 60)       # Time to live, seconds from last connect
 UNSEEN_TTL = 60                        # Time to live, seconds since first request
 CHANNEL_MAX = 18               # Max channels open per socket (default)
 ANTI_FLOOD_DELAY = 0.125       # Anti-flood delay after transmissions, seconds
-ANTI_BUZZ = 0.09               # Anti-buzz delay after queue-empty check
+ANTI_BUZZ_DELAY = 0.09         # Anti-buzz delay after queue-empty check
 
 # No user-serviceable parts below this line
 
@@ -141,6 +141,9 @@ class Connection:
                     self.last_xmit = time.time()
                 except irc.client.ServerConnectionError:
                     self.status = "disconnected"
+            elif self.status == "handshaking":
+                # Don't buzz on the empty-queue test while we're handshaking 
+                time.sleep(ANTI_BUZZ_DELAY)
             elif self.queue.empty():
                 # Queue is empty, at some point we want to time out
                 # the connection rather than holding a socket open in
@@ -159,7 +162,7 @@ class Connection:
                     # As long as this is less that the duration of a human
                     # reflex arc it is highly unlikely any human will ever
                     # notice.
-                    time.sleep(ANTI_BUZZ)
+                    time.sleep(ANTI_BUZZ_DELAY)
             elif self.status == "disconnected" \
                      and time.time() > self.last_xmit + DISCONNECT_TTL:
                 # Queue is nonempty, but the IRC server might be down. Letting