bugfix: return empty bytes immediately if read length is 0
This commit is contained in:
parent
4b01c33d54
commit
2a7b43d853
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user