Check for the stop event more aggressively in the send thread.
This commit is contained in:
parent
4b2b2d16b8
commit
94aa6673ca
1 changed files with 15 additions and 7 deletions
|
@ -630,6 +630,8 @@ class XMLStream(object):
|
||||||
# Clearing this event will pause the send loop.
|
# Clearing this event will pause the send loop.
|
||||||
self.session_started_event.clear()
|
self.session_started_event.clear()
|
||||||
|
|
||||||
|
self.__failed_send_stanza = None
|
||||||
|
|
||||||
# Send the end of stream marker.
|
# Send the end of stream marker.
|
||||||
if send_close:
|
if send_close:
|
||||||
self.send_raw(self.stream_footer, now=True)
|
self.send_raw(self.stream_footer, now=True)
|
||||||
|
@ -1152,8 +1154,10 @@ class XMLStream(object):
|
||||||
log.warning("Failed to send %s", data)
|
log.warning("Failed to send %s", data)
|
||||||
if reconnect is None:
|
if reconnect is None:
|
||||||
reconnect = self.auto_reconnect
|
reconnect = self.auto_reconnect
|
||||||
|
if not self.stop.is_set():
|
||||||
self.disconnect(reconnect, send_close=False)
|
self.disconnect(reconnect, send_close=False)
|
||||||
log.warning('SSL write error - reattempting')
|
log.warning('SSL write error - reattempting')
|
||||||
|
if not self.stop.is_set():
|
||||||
time.sleep(self.ssl_retry_delay)
|
time.sleep(self.ssl_retry_delay)
|
||||||
tries += 1
|
tries += 1
|
||||||
if count > 1:
|
if count > 1:
|
||||||
|
@ -1163,6 +1167,7 @@ class XMLStream(object):
|
||||||
log.warning("Failed to send %s", data)
|
log.warning("Failed to send %s", data)
|
||||||
if reconnect is None:
|
if reconnect is None:
|
||||||
reconnect = self.auto_reconnect
|
reconnect = self.auto_reconnect
|
||||||
|
if not self.stop.is_set():
|
||||||
self.disconnect(reconnect, send_close=False)
|
self.disconnect(reconnect, send_close=False)
|
||||||
else:
|
else:
|
||||||
self.send_queue.put(data)
|
self.send_queue.put(data)
|
||||||
|
@ -1501,8 +1506,10 @@ class XMLStream(object):
|
||||||
log.debug('SSL error - max retries reached')
|
log.debug('SSL error - max retries reached')
|
||||||
self.exception(serr)
|
self.exception(serr)
|
||||||
log.warning("Failed to send %s", data)
|
log.warning("Failed to send %s", data)
|
||||||
|
if not self.stop.is_set():
|
||||||
self.disconnect(self.auto_reconnect, send_close=False)
|
self.disconnect(self.auto_reconnect, send_close=False)
|
||||||
log.warning('SSL write error - reattempting')
|
log.warning('SSL write error - reattempting')
|
||||||
|
if not self.stop.is_set():
|
||||||
time.sleep(self.ssl_retry_delay)
|
time.sleep(self.ssl_retry_delay)
|
||||||
tries += 1
|
tries += 1
|
||||||
if count > 1:
|
if count > 1:
|
||||||
|
@ -1511,6 +1518,7 @@ class XMLStream(object):
|
||||||
except Socket.error as serr:
|
except Socket.error as serr:
|
||||||
self.event('socket_error', serr, direct=True)
|
self.event('socket_error', serr, direct=True)
|
||||||
log.warning("Failed to send %s", data)
|
log.warning("Failed to send %s", data)
|
||||||
|
if not self.stop.is_set():
|
||||||
self.__failed_send_stanza = data
|
self.__failed_send_stanza = data
|
||||||
self.disconnect(self.auto_reconnect, send_close=False)
|
self.disconnect(self.auto_reconnect, send_close=False)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
|
Loading…
Reference in a new issue