summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/xmlstream.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-11-20 12:15:39 -0800
committerLance Stout <lancestout@gmail.com>2011-11-20 12:17:35 -0800
commitfba60ffff11d42f2e6edecdfcb4200a50a844bed (patch)
treee3cdc144feaa170323914d8087a850693f02a1b1 /sleekxmpp/xmlstream/xmlstream.py
parentd1a945a3053b82d2553a48f2d2c5c69664e6fde4 (diff)
downloadslixmpp-fba60ffff11d42f2e6edecdfcb4200a50a844bed.tar.gz
slixmpp-fba60ffff11d42f2e6edecdfcb4200a50a844bed.tar.bz2
slixmpp-fba60ffff11d42f2e6edecdfcb4200a50a844bed.tar.xz
slixmpp-fba60ffff11d42f2e6edecdfcb4200a50a844bed.zip
Convert daemon threads back into normal threads.
This may need to be reverted if CTRL-C handling breaks, but everything works fine so far in testing. Resolves issue #95.
Diffstat (limited to 'sleekxmpp/xmlstream/xmlstream.py')
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 6d53022c..8d1c7e36 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -466,7 +466,7 @@ class XMLStream(object):
"""
def _handle_session_timeout():
- if not self.session_started_event.isSet():
+ if not self.session_started_event.is_set():
log.debug("Session start has taken more " + \
"than %d seconds", self.session_timeout)
self.disconnect(reconnect=self.auto_reconnect)
@@ -1055,7 +1055,6 @@ class XMLStream(object):
def start_thread(name, target):
self.__thread[name] = threading.Thread(name=name, target=target)
- self.__thread[name].daemon = True
self.__thread[name].start()
for t in range(0, HANDLER_THREADS):
@@ -1255,7 +1254,7 @@ class XMLStream(object):
"""
log.debug("Loading event runner")
try:
- while not self.stop.isSet():
+ while not self.stop.is_set():
try:
wait = self.wait_timeout
event = self.event_queue.get(True, timeout=wait)
@@ -1320,7 +1319,9 @@ class XMLStream(object):
"""
try:
while not self.stop.is_set():
- self.session_started_event.wait()
+ while not self.stop.is_set and \
+ not self.session_started_event.is_set():
+ self.session_started_event.wait(timeout=1)
if self.__failed_send_stanza is not None:
data = self.__failed_send_stanza
self.__failed_send_stanza = None