diff irclib.py @ 163:54c0e77370fd

fixed irclib.ServerConnection.disconnect() Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Tue, 19 Jan 2010 21:27:34 +0100
parents da2f2dc61e74
children 6b91ca42df98
line wrap: on
line diff
--- 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: