diff options
author | Lance Stout <lancestout@gmail.com> | 2011-06-01 15:17:04 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-06-01 15:17:04 -0700 |
commit | 788a5b73f9392c49e1bab088d558ea4a337bea2d (patch) | |
tree | 24c68e35cb74ea1bbb286722e4bd72c058e72c56 /sleekxmpp | |
parent | 5ed27bf5f65f03e14da24a60e261a175074cb7aa (diff) | |
parent | 14693233504383d4df0ed092c870d5d7baea6538 (diff) | |
download | slixmpp-788a5b73f9392c49e1bab088d558ea4a337bea2d.tar.gz slixmpp-788a5b73f9392c49e1bab088d558ea4a337bea2d.tar.bz2 slixmpp-788a5b73f9392c49e1bab088d558ea4a337bea2d.tar.xz slixmpp-788a5b73f9392c49e1bab088d558ea4a337bea2d.zip |
Merge branch 'develop' into roster
Diffstat (limited to 'sleekxmpp')
-rw-r--r-- | sleekxmpp/xmlstream/xmlstream.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 2d72de5f..fd313536 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -192,6 +192,7 @@ class XMLStream(object): self.event_queue = queue.Queue() self.send_queue = queue.Queue() + self.__failed_send_stanza = None self.scheduler = Scheduler(self.event_queue, self.stop) self.namespace_map = {StanzaBase.xml_ns: 'xml'} @@ -1021,16 +1022,21 @@ class XMLStream(object): try: while not self.stop.isSet(): self.session_started_event.wait() - try: - data = self.send_queue.get(True, 1) - except queue.Empty: - continue + if self.__failed_send_stanza is not None: + data = self.__failed_send_stanza + self.__failed_send_stanza = None + else: + try: + data = self.send_queue.get(True, 1) + except queue.Empty: + continue log.debug("SEND: %s" % data) try: self.socket.send(data.encode('utf-8')) except Socket.error as serr: self.event('socket_error', serr) log.warning("Failed to send %s" % data) + self.__failed_send_stanza = data self.disconnect(self.auto_reconnect) except KeyboardInterrupt: log.debug("Keyboard Escape Detected in _send_thread") |