mirror of https://github.com/vacp2p/nim-libp2p.git
no more buffer resets on len prefixed reads
This commit is contained in:
parent
dd3f85965b
commit
5ae37cac98
|
@ -92,7 +92,6 @@ proc readLp*(s: Connection): Future[seq[byte]] {.async, gcsafe.} =
|
|||
if res == VarintStatus.Success:
|
||||
break
|
||||
if res != VarintStatus.Success or size > DefaultReadSize:
|
||||
buffer.setLen(0)
|
||||
result = buffer
|
||||
return
|
||||
buffer.setLen(size)
|
||||
|
|
|
@ -38,7 +38,6 @@ proc readMplexVarint(conn: Connection): Future[Option[uint]] {.async, gcsafe.} =
|
|||
if res == VarintStatus.Success:
|
||||
return some(varint)
|
||||
if res != VarintStatus.Success:
|
||||
buffer.setLen(0)
|
||||
return
|
||||
except LPStreamIncompleteError:
|
||||
debug "unable to read varing", exc = getCurrentExceptionMsg()
|
||||
|
|
Loading…
Reference in New Issue