mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-09 14:40:53 +00:00
Use RawConnection.read
Instead of accessing its reader and writer directly. TODO: considering add `ReaderWriterCloser` interface and let connection and stream inherit from it.
This commit is contained in:
@ -188,11 +188,9 @@ class Mplex(IMuxedConn):
|
||||
# loop in handle_incoming
|
||||
timeout = 0.1
|
||||
try:
|
||||
header = await decode_uvarint_from_stream(self.conn.reader, timeout)
|
||||
length = await decode_uvarint_from_stream(self.conn.reader, timeout)
|
||||
message = await asyncio.wait_for(
|
||||
self.conn.reader.read(length), timeout=timeout
|
||||
)
|
||||
header = await decode_uvarint_from_stream(self.conn, timeout)
|
||||
length = await decode_uvarint_from_stream(self.conn, timeout)
|
||||
message = await asyncio.wait_for(self.conn.read(length), timeout=timeout)
|
||||
except asyncio.TimeoutError:
|
||||
return None, None, None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user