Merge branch 'ibb-fix-races' into 'master'

fix: specific cases in xep-0047 with network race conditions

See merge request poezio/slixmpp!179
This commit is contained in:
mathieui 2022-02-07 19:03:31 +01:00
commit 1e7d7bf8cb

View file

@ -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):