Update libp2p/stream_muxer/mplex/mplex_stream.py

Co-Authored-By: Alex Stokes <r.alex.stokes@gmail.com>
This commit is contained in:
Kevin Mai-Husan Chia 2019-08-16 10:08:39 +08:00
parent f2c31f6fe3
commit 8699568d43

View File

@ -47,7 +47,7 @@ class MplexStream(IMuxedStream):
:return: bytes actually read
"""
if n < 0 and n != -1:
raise ValueError("`n` can only be -1 if it is negative")
raise ValueError(f"the number of bytes to read ``n`` must be positive or -1 to indicate read until EOF")
# If the buffer is empty at first, blocking wait for data.
if len(self._buf) == 0:
self._buf.extend(await self.mplex_conn.read_buffer(self.stream_id))