# HG changeset patch # User Charly COSTE # Date 1251405205 -7200 # Node ID ebd4278e472f502e7bbabcb4f2808ca92ba38500 # Parent b048c4c03b00998c45beca47cc5b6c050b85c75f Some thread safety for irclib.py Signed-off-by: Charly COSTE diff --git a/irclib.py b/irclib.py --- a/irclib.py +++ b/irclib.py @@ -191,7 +191,8 @@ class IRC: for c in self.connections: if s == c._get_socket(): c.lock.acquire() - c.process_data() + if hasattr(c, 'socket'): + c.process_data() c.lock.release() def process_timeout(self): @@ -699,6 +700,8 @@ class ServerConnection(Connection): if not self.connected: return + self.lock.acquire() + self.connected = False self.quit(message) @@ -708,6 +711,7 @@ class ServerConnection(Connection): except socket.error, x: pass self.socket = None + self.lock.release() self._handle_event(Event("disconnect", self.server, "", [message])) def globops(self, text):