Mercurial > xib
changeset 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 | 7af07b7bf6fd |
children | 6b91ca42df98 |
files | irclib.py |
diffstat | 1 files changed, 10 insertions(+), 9 deletions(-) [+] |
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: