summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/xmlstream.py
diff options
context:
space:
mode:
authorAnton Ryzhov <anton@ryzhov.me>2013-06-20 13:07:57 +0400
committerAnton Ryzhov <anton@ryzhov.me>2013-06-20 18:30:07 +0400
commit805f1c0e392b29dd335ea6b62b6c08a17a7f6e2c (patch)
tree23b007c40bffd2591e2115ebfd9332226154db0b /sleekxmpp/xmlstream/xmlstream.py
parent7430a8ca401a4ece1b9e717e3f45c9c93dda6960 (diff)
downloadslixmpp-805f1c0e392b29dd335ea6b62b6c08a17a7f6e2c.tar.gz
slixmpp-805f1c0e392b29dd335ea6b62b6c08a17a7f6e2c.tar.bz2
slixmpp-805f1c0e392b29dd335ea6b62b6c08a17a7f6e2c.tar.xz
slixmpp-805f1c0e392b29dd335ea6b62b6c08a17a7f6e2c.zip
Use timeout constants instead of magic numbers in scheduler and event loop
Set default wait timeout as max() of previous values
Diffstat (limited to 'sleekxmpp/xmlstream/xmlstream.py')
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 478bd9c0..bf2e01fa 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -49,7 +49,7 @@ RESPONSE_TIMEOUT = 30
#: The time in seconds to wait for events from the event queue, and also the
#: time between checks for the process stop signal.
-WAIT_TIMEOUT = 0.1
+WAIT_TIMEOUT = 1.0
#: The number of threads to use to handle XML stream events. This is not the
#: same as the number of custom event handling threads.
@@ -1629,8 +1629,7 @@ class XMLStream(object):
try:
while not self.stop.is_set():
try:
- wait = self.wait_timeout
- event = self.event_queue.get(True, timeout=wait)
+ event = self.event_queue.get(True, timeout=self.wait_timeout)
except QueueEmpty:
event = None
if event is None:
@@ -1693,13 +1692,13 @@ class XMLStream(object):
while not self.stop.is_set():
while not self.stop.is_set() and \
not self.session_started_event.is_set():
- self.session_started_event.wait(timeout=0.1)
+ self.session_started_event.wait(timeout=0.1) # Wait for session start
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)
+ data = self.send_queue.get(True, timeout=self.wait_timeout) # Wait for data to send
except QueueEmpty:
continue
log.debug("SEND: %s", data)