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: if res == VarintStatus.Success:
break break
if res != VarintStatus.Success or size > DefaultReadSize: if res != VarintStatus.Success or size > DefaultReadSize:
buffer.setLen(0)
result = buffer result = buffer
return return
buffer.setLen(size) buffer.setLen(size)

View File

@ -38,7 +38,6 @@ proc readMplexVarint(conn: Connection): Future[Option[uint]] {.async, gcsafe.} =
if res == VarintStatus.Success: if res == VarintStatus.Success:
return some(varint) return some(varint)
if res != VarintStatus.Success: if res != VarintStatus.Success:
buffer.setLen(0)
return return
except LPStreamIncompleteError: except LPStreamIncompleteError:
debug "unable to read varing", exc = getCurrentExceptionMsg() debug "unable to read varing", exc = getCurrentExceptionMsg()