diff options
author | Louis-Francis Ratté-Boulianne <louis-francis.ratte-boulianne@collabora.co.uk> | 2011-08-16 11:07:36 -0400 |
---|---|---|
committer | Louis-Francis Ratté-Boulianne <louis-francis.ratte-boulianne@collabora.co.uk> | 2011-08-16 11:07:36 -0400 |
commit | 3b8f9fd8bb929fb35cab1bd0ae3b3ff7a1aacbd5 (patch) | |
tree | e835c82b1f11d7feac47555a8894b491fbe85a8b | |
parent | 9e7d6f22ab3aa1a52e19308ff2c2ce8e8e9a746e (diff) |
bugfix: don't use 100% cpu when a file transfer session is ended.
-rw-r--r-- | papyon/gnet/io/sock.py | 4 | ||||
-rw-r--r-- | papyon/gnet/io/ssl_socket.py | 4 | ||||
-rw-r--r-- | papyon/msnp/switchboard.py | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/papyon/gnet/io/sock.py b/papyon/gnet/io/sock.py index 15825ba..7130588 100644 --- a/papyon/gnet/io/sock.py +++ b/papyon/gnet/io/sock.py @@ -24,6 +24,7 @@ from iochannel import GIOChannelClient import gobject import socket +import sys __all__ = ['SocketClient'] @@ -74,6 +75,9 @@ class SocketClient(GIOChannelClient): return False if buf != "": self.emit("received", buf, len(buf)) + elif sys.platform != "win32": + self.close() + return False # Check for error/EOF if cond & (gobject.IO_ERR | gobject.IO_HUP): diff --git a/papyon/gnet/io/ssl_socket.py b/papyon/gnet/io/ssl_socket.py index cb7f25e..0d49c99 100644 --- a/papyon/gnet/io/ssl_socket.py +++ b/papyon/gnet/io/ssl_socket.py @@ -24,6 +24,7 @@ from iochannel import GIOChannelClient import gobject import socket +import sys import OpenSSL.SSL as OpenSSL __all__ = ['SSLSocketClient'] @@ -83,6 +84,9 @@ class SSLSocketClient(GIOChannelClient): buf = self._transport.recv(2048) if buf != "": self.emit("received", buf, len(buf)) + elif sys.platform != "win32": + self.close() + return False except (OpenSSL.WantX509LookupError, OpenSSL.WantReadError, OpenSSL.WantWriteError): pass diff --git a/papyon/msnp/switchboard.py b/papyon/msnp/switchboard.py index 7bb3d83..14c6eff 100644 --- a/papyon/msnp/switchboard.py +++ b/papyon/msnp/switchboard.py @@ -179,6 +179,7 @@ class SwitchboardProtocol(BaseProtocol): return if self.inactivity_timer_id: gobject.source_remove(self.inactivity_timer_id) + self.inactivity_timer_id = 0 if inactivity: logger.info("Switchboard timed out. Going to leave it.") logger.info("Leaving switchboard %s" % self.__session_id) |