summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2022-02-04 18:18:39 +0100
committermathieui <mathieui@mathieui.net>2022-02-05 12:38:48 +0100
commite543e22e78241ad0cc3ee8704a9187a26eb08b60 (patch)
tree2b8b7e68df6d6af1f4c72798380799afb42ed0dc
parent714f9aae0d90f9456542906b0ea14298f1a096bf (diff)
downloadslixmpp-e543e22e78241ad0cc3ee8704a9187a26eb08b60.tar.gz
slixmpp-e543e22e78241ad0cc3ee8704a9187a26eb08b60.tar.bz2
slixmpp-e543e22e78241ad0cc3ee8704a9187a26eb08b60.tar.xz
slixmpp-e543e22e78241ad0cc3ee8704a9187a26eb08b60.zip
fix: specific cases in xep-0047 with network race conditions
-rw-r--r--slixmpp/plugins/xep_0047/stream.py7
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):