no more buffer resets on len prefixed reads

This commit is contained in:
Dmitriy Ryajov 2019-09-25 12:53:31 -06:00
parent dd3f85965b
commit 5ae37cac98
2 changed files with 0 additions and 2 deletions

View File

@ -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)

View File

@ -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()