# HG changeset patch # User Charly COSTE # Date 1263932854 -3600 # Node ID 54c0e77370fd9335b6ee9f0506dd8f999e0c3208 # Parent 7af07b7bf6fd1c492bb7ffeb99fc08ee1f1db0f6 fixed irclib.ServerConnection.disconnect() Signed-off-by: Charly COSTE diff --git a/irclib.py b/irclib.py --- a/irclib.py +++ b/irclib.py @@ -749,20 +749,21 @@ class ServerConnection(Connection): message -- Quit message. """ - if not self.connected: - return self.lock.acquire() - self.connected = False + if self.connected: + self.connected = False - self.quit(message) + if self.socket and self.socket != 'closed': + self.quit(message) - try: - self.socket.close() - except socket.error, x: - pass - self.socket = 'closed' + try: + self.socket.close() + except socket.error, x: + pass + self.socket = 'closed' + self.lock.release() if volontary == False: