diff --git a/libp2p/connection.nim b/libp2p/connection.nim index 460a0fc..9ae61e2 100644 --- a/libp2p/connection.nim +++ b/libp2p/connection.nim @@ -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) diff --git a/libp2p/muxers/mplex/coder.nim b/libp2p/muxers/mplex/coder.nim index acf4f9c..af406a4 100644 --- a/libp2p/muxers/mplex/coder.nim +++ b/libp2p/muxers/mplex/coder.nim @@ -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()