diff options
author | Brian Beggs <macdiesel@gmail.com> | 2010-07-02 21:34:43 +0800 |
---|---|---|
committer | Thom Nichols <tmnichols@gmail.com> | 2010-07-02 22:29:08 +0800 |
commit | 4b00baab1e99efe0a075116337422da4eb18b37f (patch) | |
tree | 0044ac1181ae93573a9e774986f3cc85765d8cba | |
parent | fe1d3004ccf6ec30296bc9b894ddfa2925f2a27b (diff) | |
download | slixmpp-4b00baab1e99efe0a075116337422da4eb18b37f.tar.gz slixmpp-4b00baab1e99efe0a075116337422da4eb18b37f.tar.bz2 slixmpp-4b00baab1e99efe0a075116337422da4eb18b37f.tar.xz slixmpp-4b00baab1e99efe0a075116337422da4eb18b37f.zip |
reconnection fix: xmlstream now catches XMLParserError and restarts the stream
-rw-r--r-- | sleekxmpp/xmlstream/xmlstream.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 842dfee2..1fb3f8bb 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -42,9 +42,6 @@ if sys.version_info < (3, 0): class RestartStream(Exception): pass -class CloseStream(Exception): - pass - stanza_extensions = {} RECONNECT_MAX_DELAY = 3600 @@ -225,9 +222,6 @@ class XMLStream(object): except socket.timeout: logging.debug('socket rcv timeout') pass - except CloseStream: - # TODO warn that the listener thread is exiting!!! - pass except RestartStream: logging.debug("Restarting stream...") continue # DON'T re-initialize the stream -- this exception is sent @@ -236,13 +230,14 @@ class XMLStream(object): logging.debug("System interrupt detected") self.shutdown() self.eventqueue.put(('quit', None, None)) - except cElementTree.XMLParserError: + except cElementTree.XMLParserError: #if there is an xml parsing exception, assume stream needs to be restarted logging.warn('XML RCV parsing error!', exc_info=1) - # don't restart the stream on an XML parse error. + if self.should_reconnect: self.disconnect(reconnect=True) + else: self.disconnect() except: logging.exception('Unexpected error in RCV thread') - if self.should_reconnect: - self.disconnect(reconnect=True) + if self.should_reconnect: self.disconnect(reconnect=True) + else: self.disconnect() logging.debug('Quitting Process thread') |