# HG changeset patch # User Charly COSTE # Date 1251133245 -7200 # Node ID 9f72353e4064ea3fea0407556dfde79a5068aaf5 # Parent b8c9ddf320f899936e79b0f6d334b67a663e4673 Minor change to irclib.py Signed-off-by: Charly COSTE diff --git a/irclib.py b/irclib.py --- 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 = {}