mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 08:00:54 +00:00
PR feedback for MplexStream.read
This commit is contained in:
committed by
Kevin Mai-Husan Chia
parent
8699568d43
commit
c5f32bf431
@ -75,7 +75,8 @@ class Mplex(IMuxedConn):
|
||||
|
||||
async def read_buffer(self, stream_id: int) -> bytes:
|
||||
"""
|
||||
Read a message from stream_id's buffer, check raw connection for new messages
|
||||
Read a message from stream_id's buffer, check raw connection for new messages.
|
||||
`StreamNotFound` is raised when stream `stream_id` is not found in `Mplex`.
|
||||
:param stream_id: stream id of stream to read from
|
||||
:return: message read
|
||||
"""
|
||||
@ -86,6 +87,7 @@ class Mplex(IMuxedConn):
|
||||
async def read_buffer_nonblocking(self, stream_id: int) -> Optional[bytes]:
|
||||
"""
|
||||
Read a message from `stream_id`'s buffer, non-blockingly.
|
||||
`StreamNotFound` is raised when stream `stream_id` is not found in `Mplex`.
|
||||
"""
|
||||
if stream_id not in self.buffers:
|
||||
raise StreamNotFound(f"stream {stream_id} is not found")
|
||||
|
||||
Reference in New Issue
Block a user