summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/xmlstream.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-01-28 18:54:46 -0800
committerLance Stout <lancestout@gmail.com>2012-01-28 18:54:46 -0800
commit3ab7c8bcc39d7d377553116a5f41a3ea8c1fb436 (patch)
tree10c5107aa31b56cb978e69d6ea6dee18f80bc026 /sleekxmpp/xmlstream/xmlstream.py
parent8f25acd0f3fad0671c1cf9da7cdf07ff482741c2 (diff)
downloadslixmpp-3ab7c8bcc39d7d377553116a5f41a3ea8c1fb436.tar.gz
slixmpp-3ab7c8bcc39d7d377553116a5f41a3ea8c1fb436.tar.bz2
slixmpp-3ab7c8bcc39d7d377553116a5f41a3ea8c1fb436.tar.xz
slixmpp-3ab7c8bcc39d7d377553116a5f41a3ea8c1fb436.zip
Make socket_error run as a direct event to ensure that it is handled.
Socket errors that occur before stream processing begins could not be handled as the event loop would not be running yet. Resolves issue #142
Diffstat (limited to 'sleekxmpp/xmlstream/xmlstream.py')
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 4c8696b3..0f740474 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -454,7 +454,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)
+ self.event('socket_error', serr, direct=True)
log.error(error_msg, self.address[0], self.address[1],
serr.errno, serr.strerror)
self.reconnect_delay = delay
@@ -507,7 +507,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)
+ self.event('socket_error', serr, direct=True)
log.error(error_msg, self.address[0], self.address[1],
serr.errno, serr.strerror)
return False
@@ -578,7 +578,7 @@ class XMLStream(object):
self.socket.close()
self.filesocket.close()
except Socket.error as serr:
- self.event('socket_error', serr)
+ self.event('socket_error', serr, direct=True)
finally:
#clear your application state
self.event("disconnected", direct=True)
@@ -1092,7 +1092,7 @@ class XMLStream(object):
if count > 1:
log.debug('SENT: %d chunks', count)
except Socket.error as serr:
- self.event('socket_error', serr)
+ self.event('socket_error', serr, direct=True)
log.warning("Failed to send %s", data)
if reconnect is None:
reconnect = self.auto_reconnect
@@ -1193,7 +1193,7 @@ class XMLStream(object):
shutdown = True
self.exception(e)
except Socket.error as serr:
- self.event('socket_error', serr)
+ self.event('socket_error', serr, direct=True)
log.exception('Socket Error')
except Exception as e:
if not self.stop.is_set():
@@ -1445,7 +1445,7 @@ class XMLStream(object):
log.debug('SENT: %d chunks', count)
self.send_queue.task_done()
except Socket.error as serr:
- self.event('socket_error', serr)
+ self.event('socket_error', serr, direct=True)
log.warning("Failed to send %s", data)
self.__failed_send_stanza = data
self.disconnect(self.auto_reconnect)