mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-12-18 03:00:18 +00:00
Merge branch 'develop' into roster
This commit is contained in:
commit
788a5b73f9
1 changed files with 10 additions and 4 deletions
|
@ -192,6 +192,7 @@ class XMLStream(object):
|
||||||
|
|
||||||
self.event_queue = queue.Queue()
|
self.event_queue = queue.Queue()
|
||||||
self.send_queue = queue.Queue()
|
self.send_queue = queue.Queue()
|
||||||
|
self.__failed_send_stanza = None
|
||||||
self.scheduler = Scheduler(self.event_queue, self.stop)
|
self.scheduler = Scheduler(self.event_queue, self.stop)
|
||||||
|
|
||||||
self.namespace_map = {StanzaBase.xml_ns: 'xml'}
|
self.namespace_map = {StanzaBase.xml_ns: 'xml'}
|
||||||
|
@ -1021,16 +1022,21 @@ class XMLStream(object):
|
||||||
try:
|
try:
|
||||||
while not self.stop.isSet():
|
while not self.stop.isSet():
|
||||||
self.session_started_event.wait()
|
self.session_started_event.wait()
|
||||||
try:
|
if self.__failed_send_stanza is not None:
|
||||||
data = self.send_queue.get(True, 1)
|
data = self.__failed_send_stanza
|
||||||
except queue.Empty:
|
self.__failed_send_stanza = None
|
||||||
continue
|
else:
|
||||||
|
try:
|
||||||
|
data = self.send_queue.get(True, 1)
|
||||||
|
except queue.Empty:
|
||||||
|
continue
|
||||||
log.debug("SEND: %s" % data)
|
log.debug("SEND: %s" % data)
|
||||||
try:
|
try:
|
||||||
self.socket.send(data.encode('utf-8'))
|
self.socket.send(data.encode('utf-8'))
|
||||||
except Socket.error as serr:
|
except Socket.error as serr:
|
||||||
self.event('socket_error', serr)
|
self.event('socket_error', serr)
|
||||||
log.warning("Failed to send %s" % data)
|
log.warning("Failed to send %s" % data)
|
||||||
|
self.__failed_send_stanza = data
|
||||||
self.disconnect(self.auto_reconnect)
|
self.disconnect(self.auto_reconnect)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
log.debug("Keyboard Escape Detected in _send_thread")
|
log.debug("Keyboard Escape Detected in _send_thread")
|
||||||
|
|
Loading…
Reference in a new issue