fix: specific cases in xep-0047 with network race conditions
This commit is contained in:
parent
714f9aae0d
commit
e543e22e78
1 changed files with 7 additions and 0 deletions
|
@ -99,6 +99,13 @@ class IBBytestream(object):
|
||||||
:returns: All bytes accumulated in the stream.
|
:returns: All bytes accumulated in the stream.
|
||||||
"""
|
"""
|
||||||
result = b''
|
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()
|
end_future = asyncio.Future()
|
||||||
|
|
||||||
def on_close(stream):
|
def on_close(stream):
|
||||||
|
|
Loading…
Reference in a new issue