Shorten nick negotiation by choosing a random start nick from a large range.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 2 Oct 2012 21:29:20 +0000 (17:29 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 2 Oct 2012 21:29:20 +0000 (17:29 -0400)
NEWS
irkerd

diff --git a/NEWS b/NEWS
index ff46cd06ac76471789ebb6b8e17725e4a12c26a5..008cdf7eb7f929c882a43f8b6d2b0bfb5d70fc4c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,7 @@
 
 1.5 @
   Mercurial support.
+  Shorten nick negatiation by choosing a random bick base from a large range.
 
 
 
diff --git a/irkerd b/irkerd
index 98be5d8d11e46b76e9e0c45e0439150ef33d48ab..9d98d5e737e86a50aababac6da05bc93790f3ae3 100755 (executable)
--- a/irkerd
+++ b/irkerd
@@ -100,11 +100,11 @@ version = "1.4"
 # draft-brocklesby-irc-isupport-03 at <http://www.mirc.com/isupport.html>.
 
 class Connection:
-    def __init__(self, irkerd, servername, port, nick_base=1):
+    def __init__(self, irkerd, servername, port):
         self.irker = irkerd
         self.servername = servername
         self.port = port
-        self.nick_trial = nick_base
+        self.nick_trial = random.randint(1, 990)
         self.connection = None
         self.status = "unseen"
         self.last_xmit = time.time()
@@ -279,8 +279,7 @@ class Dispatcher:
         if not eligibles:
             newconn = Connection(self.irker,
                                  self.servername,
-                                 self.port,
-                                 len(self.connections)+1)
+                                 self.port)
             self.connections.append(newconn)
             eligibles = [newconn]
         eligibles[0].enqueue(channel, message)