diff options
author | Lance Stout <lancestout@gmail.com> | 2013-06-22 14:35:20 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2013-06-22 14:35:20 -0700 |
commit | e76a48393159592e73421541ed05e78c287faf00 (patch) | |
tree | 4875c5a9d3e2df57f79b8e3800470ce315a8c1e7 /sleekxmpp/xmlstream/xmlstream.py | |
parent | c0437d2de86f5b6ffce17061fc3aed0e35441fd3 (diff) | |
parent | 37a804320204726480732704036fad9c7f6fff78 (diff) | |
download | slixmpp-e76a48393159592e73421541ed05e78c287faf00.tar.gz slixmpp-e76a48393159592e73421541ed05e78c287faf00.tar.bz2 slixmpp-e76a48393159592e73421541ed05e78c287faf00.tar.xz slixmpp-e76a48393159592e73421541ed05e78c287faf00.zip |
Merge branch 'develop' of github.com:fritzy/SleekXMPP into develop
Diffstat (limited to 'sleekxmpp/xmlstream/xmlstream.py')
-rw-r--r-- | sleekxmpp/xmlstream/xmlstream.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 478bd9c0..54bc7cdf 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. @@ -1294,6 +1294,9 @@ class XMLStream(object): try: sent += self.socket.send(data[sent:]) count += 1 + except Socket.error as serr: + if serr.errno != errno.EINTR: + raise except ssl.SSLError as serr: if tries >= self.ssl_retry_max: log.debug('SSL error: max retries reached') @@ -1629,8 +1632,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 +1695,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) @@ -1715,6 +1717,9 @@ class XMLStream(object): try: sent += self.socket.send(enc_data[sent:]) count += 1 + except Socket.error as serr: + if serr.errno != errno.EINTR: + raise except ssl.SSLError as serr: if tries >= self.ssl_retry_max: log.debug('SSL error: max retries reached') |