changeset 43:9f72353e4064

Minor change to irclib.py Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Mon, 24 Aug 2009 19:00:45 +0200
parents b8c9ddf320f8
children 3d964ca1cf89
files irclib.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/irclib.py
+++ b/irclib.py
@@ -395,6 +395,7 @@ class ServerConnection(Connection):
         self.server = server
         self.port = port
         self.nickname = nickname
+        self.lock = threading.RLock()
 
 
     def __str__(self):
@@ -426,9 +427,9 @@ class ServerConnection(Connection):
         Returns the ServerConnection object.
         """
         
+        self.lock.acquire()
         
         if self.connected == True:
-            self.lock.acquire()
             self.used_by += 1
             self.irclibobj.bot.error('===> Debug: using existing IRC connection for '+str(self)+', this connection is now used by '+str(self.used_by)+' bridges', debug=True)
             self.nick(self.real_nickname, callback=nick_callback)
@@ -436,8 +437,6 @@ class ServerConnection(Connection):
             return self
 
 
-        self.lock = threading.RLock()
-        self.lock.acquire()
         self.nick_callbacks = []
         self.previous_buffer = ""
         self.handlers = {}