error when snappy frame is short

This commit is contained in:
Jacek Sieka 2020-05-18 17:27:14 +02:00 committed by tersec
parent 6be7d64e8c
commit a1689f2aaf
1 changed files with 2 additions and 1 deletions

View File

@ -21,7 +21,7 @@ proc uncompressFramedStream*(conn: Connection,
try:
await conn.readExactly(addr frameHeader[0], frameHeader.len)
except LPStreamEOFError, LPStreamIncompleteError:
break
return err "no snappy frame"
let x = uint32.fromBytesLE frameHeader
let id = x and 0xFF
@ -118,6 +118,7 @@ proc readChunkPayload(conn: Connection,
if data.isOk:
return ok SSZ.decode(data.get(), MsgType)
else:
debug "Failed getting snappy frame", msg = $data.error, conn = $conn
return neterr InvalidSnappyBytes
proc readResponseChunk(conn: Connection,