mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Add detection for disconnections in mplex
This commit is contained in:
@ -41,14 +41,8 @@ async def decode_uvarint_from_stream(reader: Reader) -> int:
|
||||
if shift > SHIFT_64_BIT_MAX:
|
||||
raise ParseError("TODO: better exception msg: Integer is too large...")
|
||||
|
||||
byte = await reader.read(1)
|
||||
|
||||
try:
|
||||
value = byte[0]
|
||||
except IndexError:
|
||||
raise ParseError(
|
||||
"Unexpected end of stream while parsing LEB128 encoded integer"
|
||||
)
|
||||
byte = await read_exactly(reader, 1)
|
||||
value = byte[0]
|
||||
|
||||
res += (value & LOW_MASK) << shift
|
||||
|
||||
|
||||
Reference in New Issue
Block a user