Skip to content

Commit 275d649

Browse files
authored
move header.length check in yamux to original location (#1069)
1 parent 467b5b4 commit 275d649

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libp2p/muxers/yamux/yamux.nim

+4-4
Original file line numberDiff line numberDiff line change
@@ -555,13 +555,13 @@ method handle*(m: Yamux) {.async: (raises: []).} =
555555
if flushed[] < 0:
556556
raise newException(YamuxError,
557557
"Peer exhausted the recvWindow after reset")
558+
if header.length > 0:
559+
var buffer = newSeqUninitialized[byte](header.length)
560+
await m.connection.readExactly(
561+
addr buffer[0], int(header.length))
558562
do:
559563
raise newException(YamuxError,
560564
"Unknown stream ID: " & $header.streamId)
561-
if header.length > 0:
562-
var buffer = newSeqUninitialized[byte](header.length)
563-
await m.connection.readExactly(
564-
addr buffer[0], int(header.length))
565565
continue
566566

567567
let channel =

0 commit comments

Comments
 (0)