Merge branch 'develop' of github.com:fritzy/SleekXMPP into develop
This commit is contained in:
commit
eb63825dfd
1 changed files with 14 additions and 11 deletions
|
@ -462,10 +462,10 @@ class XMLStream(object):
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
elapsed += 0.1
|
elapsed += 0.1
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
self.stop.set()
|
self.set_stop()
|
||||||
return False
|
return False
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
self.stop.set()
|
self.set_stop()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if self.default_domain:
|
if self.default_domain:
|
||||||
|
@ -707,7 +707,7 @@ class XMLStream(object):
|
||||||
self.stream_end_event.set()
|
self.stream_end_event.set()
|
||||||
|
|
||||||
if not self.auto_reconnect:
|
if not self.auto_reconnect:
|
||||||
self.stop.set()
|
self.set_stop()
|
||||||
if self._disconnect_wait_for_threads:
|
if self._disconnect_wait_for_threads:
|
||||||
self._wait_for_threads()
|
self._wait_for_threads()
|
||||||
|
|
||||||
|
@ -724,7 +724,7 @@ class XMLStream(object):
|
||||||
|
|
||||||
def abort(self):
|
def abort(self):
|
||||||
self.session_started_event.clear()
|
self.session_started_event.clear()
|
||||||
self.stop.set()
|
self.set_stop()
|
||||||
if self._disconnect_wait_for_threads:
|
if self._disconnect_wait_for_threads:
|
||||||
self._wait_for_threads()
|
self._wait_for_threads()
|
||||||
try:
|
try:
|
||||||
|
@ -1360,6 +1360,13 @@ class XMLStream(object):
|
||||||
if self.__thread_count == 0:
|
if self.__thread_count == 0:
|
||||||
self.__thread_cond.notify()
|
self.__thread_cond.notify()
|
||||||
|
|
||||||
|
def set_stop(self):
|
||||||
|
self.stop.set()
|
||||||
|
|
||||||
|
# Unlock queues
|
||||||
|
self.event_queue.put(None)
|
||||||
|
self.send_queue.put(None)
|
||||||
|
|
||||||
def _wait_for_threads(self):
|
def _wait_for_threads(self):
|
||||||
with self.__thread_cond:
|
with self.__thread_cond:
|
||||||
if self.__thread_count != 0:
|
if self.__thread_count != 0:
|
||||||
|
@ -1632,10 +1639,7 @@ class XMLStream(object):
|
||||||
log.debug("Loading event runner")
|
log.debug("Loading event runner")
|
||||||
try:
|
try:
|
||||||
while not self.stop.is_set():
|
while not self.stop.is_set():
|
||||||
try:
|
event = self.event_queue.get()
|
||||||
event = self.event_queue.get(True, timeout=self.wait_timeout)
|
|
||||||
except QueueEmpty:
|
|
||||||
event = None
|
|
||||||
if event is None:
|
if event is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -1701,9 +1705,8 @@ class XMLStream(object):
|
||||||
data = self.__failed_send_stanza
|
data = self.__failed_send_stanza
|
||||||
self.__failed_send_stanza = None
|
self.__failed_send_stanza = None
|
||||||
else:
|
else:
|
||||||
try:
|
data = self.send_queue.get() # Wait for data to send
|
||||||
data = self.send_queue.get(True, timeout=self.wait_timeout) # Wait for data to send
|
if data is None:
|
||||||
except QueueEmpty:
|
|
||||||
continue
|
continue
|
||||||
log.debug("SEND: %s", data)
|
log.debug("SEND: %s", data)
|
||||||
enc_data = data.encode('utf-8')
|
enc_data = data.encode('utf-8')
|
||||||
|
|
Loading…
Reference in a new issue