mirror of https://github.com/vacp2p/nim-libp2p.git
don't reset buffer on exception
This commit is contained in:
parent
6baf089bb4
commit
99869aa8b8
|
@ -100,7 +100,6 @@ proc readLp*(s: Connection): Future[seq[byte]] {.async, gcsafe.} =
|
||||||
await s.readExactly(addr buffer[0], int(size))
|
await s.readExactly(addr buffer[0], int(size))
|
||||||
except LPStreamIncompleteError, LPStreamReadError:
|
except LPStreamIncompleteError, LPStreamReadError:
|
||||||
error "readLp: could not read from remote", exception = getCurrentExceptionMsg()
|
error "readLp: could not read from remote", exception = getCurrentExceptionMsg()
|
||||||
buffer.setLen(0)
|
|
||||||
|
|
||||||
result = buffer
|
result = buffer
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ proc readMplexVarint(conn: Connection): Future[Option[uint]] {.async, gcsafe.} =
|
||||||
buffer.setLen(0)
|
buffer.setLen(0)
|
||||||
return
|
return
|
||||||
except LPStreamIncompleteError:
|
except LPStreamIncompleteError:
|
||||||
buffer.setLen(0)
|
debug "unable to read varing", exc = getCurrentExceptionMsg()
|
||||||
|
|
||||||
proc readMsg*(conn: Connection): Future[Option[Msg]] {.async, gcsafe.} =
|
proc readMsg*(conn: Connection): Future[Option[Msg]] {.async, gcsafe.} =
|
||||||
let headerVarint = await conn.readMplexVarint()
|
let headerVarint = await conn.readMplexVarint()
|
||||||
|
|
Loading…
Reference in New Issue