move `header.length` check in `yamux` to original location (#1069)

This commit is contained in:
Etan Kissling 2024-03-20 13:35:44 +01:00 committed by GitHub
parent 467b5b4f0c
commit 275d649287
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -555,13 +555,13 @@ method handle*(m: Yamux) {.async: (raises: []).} =
if flushed[] < 0:
raise newException(YamuxError,
"Peer exhausted the recvWindow after reset")
if header.length > 0:
var buffer = newSeqUninitialized[byte](header.length)
await m.connection.readExactly(
addr buffer[0], int(header.length))
do:
raise newException(YamuxError,
"Unknown stream ID: " & $header.streamId)
if header.length > 0:
var buffer = newSeqUninitialized[byte](header.length)
await m.connection.readExactly(
addr buffer[0], int(header.length))
continue
let channel =