# HG changeset patch # User Charly COSTE # Date 1251129997 -7200 # Node ID b8c9ddf320f899936e79b0f6d334b67a663e4673 # Parent 4c4f4ee72e174e077445973933b011aa15170301 Thread safety for bot.close_xmpp_connection(). Signed-off-by: Charly COSTE diff --git a/bot.py b/bot.py --- a/bot.py +++ b/bot.py @@ -454,12 +454,14 @@ class bot(Thread): if not self.xmpp_connections.has_key(nickname): return c = self.xmpp_connections[nickname] + c.lock.acquire() c.used_by -= 1 if c.used_by < 1: self.error('===> Debug: closing XMPP connection for "'+nickname+'"', debug=True) self.xmpp_connections.pop(nickname) del c else: + c.lock.release() self.error('===> Debug: XMPP connection for "'+nickname+'" is now used by '+str(c.used_by)+' bridges', debug=True)