diff options
author | Lance Stout <lancestout@gmail.com> | 2011-08-25 16:45:34 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-08-25 16:45:34 -0700 |
commit | 802dd8393d83c9aaa4f2f87f6fdaabbd8d9b8cdf (patch) | |
tree | 155489e0b1cb60137ee676a9924cd283b18e4348 /sleekxmpp/xmlstream | |
parent | fe6bc31c604f86d8e85a7532f983850bb281922e (diff) | |
download | slixmpp-802dd8393d83c9aaa4f2f87f6fdaabbd8d9b8cdf.tar.gz slixmpp-802dd8393d83c9aaa4f2f87f6fdaabbd8d9b8cdf.tar.bz2 slixmpp-802dd8393d83c9aaa4f2f87f6fdaabbd8d9b8cdf.tar.xz slixmpp-802dd8393d83c9aaa4f2f87f6fdaabbd8d9b8cdf.zip |
Make the timeout for event queue checks configurable.
Now defaults xmlstream.WAIT_TIMEOUT, and settable with
self.wait_timeout.
The new default timeout is 1sec instead of 5sec.
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r-- | sleekxmpp/xmlstream/xmlstream.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 0f01afd3..6f2ed304 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -47,6 +47,10 @@ else: # The time in seconds to wait before timing out waiting for response stanzas. 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 = 1 + # The number of threads to use to handle XML stream events. This is not the # same as the number of custom event handling threads. HANDLER_THREADS must # be at least 1. @@ -178,6 +182,7 @@ class XMLStream(object): self.ssl_version = ssl.PROTOCOL_TLSv1 self.ca_certs = None + self.wait_timeout = WAIT_TIMEOUT self.response_timeout = RESPONSE_TIMEOUT self.reconnect_delay = None self.reconnect_max_delay = RECONNECT_MAX_DELAY @@ -1210,7 +1215,8 @@ class XMLStream(object): try: while not self.stop.isSet(): try: - event = self.event_queue.get(True, timeout=5) + wait = self.wait_timeout + event = self.event_queue.get(True, timeout=wait) except queue.Empty: event = None if event is None: |