diff options
author | mathieui <mathieui@mathieui.net> | 2022-02-07 19:03:31 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2022-02-07 19:03:31 +0100 |
commit | 1e7d7bf8cbddfdeeed698a239979d40003a8e574 (patch) | |
tree | 2b8b7e68df6d6af1f4c72798380799afb42ed0dc | |
parent | 714f9aae0d90f9456542906b0ea14298f1a096bf (diff) | |
parent | e543e22e78241ad0cc3ee8704a9187a26eb08b60 (diff) | |
download | slixmpp-1e7d7bf8cbddfdeeed698a239979d40003a8e574.tar.gz slixmpp-1e7d7bf8cbddfdeeed698a239979d40003a8e574.tar.bz2 slixmpp-1e7d7bf8cbddfdeeed698a239979d40003a8e574.tar.xz slixmpp-1e7d7bf8cbddfdeeed698a239979d40003a8e574.zip |
Merge branch 'ibb-fix-races' into 'master'
fix: specific cases in xep-0047 with network race conditions
See merge request poezio/slixmpp!179
-rw-r--r-- | slixmpp/plugins/xep_0047/stream.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/slixmpp/plugins/xep_0047/stream.py b/slixmpp/plugins/xep_0047/stream.py index 0cda5dd9..29e70707 100644 --- a/slixmpp/plugins/xep_0047/stream.py +++ b/slixmpp/plugins/xep_0047/stream.py @@ -99,6 +99,13 @@ class IBBytestream(object): :returns: All bytes accumulated in the stream. """ result = b'' + while not self.recv_queue.empty(): + result += self.recv_queue.get_nowait() + if max_data and len(result) > max_data: + return result + if self.stream_in_closed: + return result + end_future = asyncio.Future() def on_close(stream): |