diff options
author | Lance Stout <lancestout@gmail.com> | 2011-01-16 13:07:39 -0500 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-01-16 13:07:39 -0500 |
commit | cb85d4a5297b0eb6cc24052321b38f9f29f62004 (patch) | |
tree | d4fa679e838b9cf8227c627c6469a3da76589676 /sleekxmpp/xmlstream/xmlstream.py | |
parent | ead3af31351c3468e27307ce1999d325d7f17ca9 (diff) | |
download | slixmpp-cb85d4a5297b0eb6cc24052321b38f9f29f62004.tar.gz slixmpp-cb85d4a5297b0eb6cc24052321b38f9f29f62004.tar.bz2 slixmpp-cb85d4a5297b0eb6cc24052321b38f9f29f62004.tar.xz slixmpp-cb85d4a5297b0eb6cc24052321b38f9f29f62004.zip |
Raise the event 'socket_error' when a socket error occurs.
Will be most useful for debugging and responding to failed
connection attempts.
Diffstat (limited to 'sleekxmpp/xmlstream/xmlstream.py')
-rw-r--r-- | sleekxmpp/xmlstream/xmlstream.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 3cf28ed8..39b10a2a 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -292,6 +292,7 @@ class XMLStream(object): return True except Socket.error as serr: error_msg = "Could not connect to %s:%s. Socket Error #%s: %s" + self.event('socket_error', serr) log.error(error_msg % (self.address[0], self.address[1], serr.errno, serr.strerror)) time.sleep(1) @@ -327,7 +328,7 @@ class XMLStream(object): self.filesocket.close() self.socket.shutdown(Socket.SHUT_RDWR) except Socket.error as serr: - pass + self.event('socket_error', serr) finally: #clear your application state self.event("disconnected", direct=True) @@ -734,7 +735,8 @@ class XMLStream(object): except SystemExit: log.debug("SystemExit in _process") self.stop.set() - except Socket.error: + except Socket.error as serr: + self.event('socket_error', serr) log.exception('Socket Error') except: if not self.stop.isSet(): |