mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
bugfix: return empty bytes immediately if read length is 0
This commit is contained in:
@ -111,6 +111,9 @@ class SecureSession(BaseSession):
|
||||
self.high_watermark = len(msg)
|
||||
|
||||
async def read(self, n: int = -1) -> bytes:
|
||||
if n == 0:
|
||||
return bytes()
|
||||
|
||||
data_from_buffer = self._drain(n)
|
||||
if len(data_from_buffer) > 0:
|
||||
return data_from_buffer
|
||||
|
||||
Reference in New Issue
Block a user