don't reset buffer on exception

This commit is contained in:
Dmitriy Ryajov 2019-09-25 12:41:57 -06:00
parent 6baf089bb4
commit 99869aa8b8
2 changed files with 1 additions and 2 deletions

View File

@ -100,7 +100,6 @@ proc readLp*(s: Connection): Future[seq[byte]] {.async, gcsafe.} =
await s.readExactly(addr buffer[0], int(size))
except LPStreamIncompleteError, LPStreamReadError:
error "readLp: could not read from remote", exception = getCurrentExceptionMsg()
buffer.setLen(0)
result = buffer

View File

@ -41,7 +41,7 @@ proc readMplexVarint(conn: Connection): Future[Option[uint]] {.async, gcsafe.} =
buffer.setLen(0)
return
except LPStreamIncompleteError:
buffer.setLen(0)
debug "unable to read varing", exc = getCurrentExceptionMsg()
proc readMsg*(conn: Connection): Future[Option[Msg]] {.async, gcsafe.} =
let headerVarint = await conn.readMplexVarint()