mirror of
https://github.com/status-im/nim-eth-p2p.git
synced 2025-01-13 00:04:31 +00:00
Fixed msg len encoding
This commit is contained in:
parent
20033b499b
commit
847fac0635
@ -137,9 +137,9 @@ proc encryptMsg*(msg: BytesRange, secrets: var SecretState): seq[byte] =
|
|||||||
raise newException(OverflowError, "RLPx message size exceeds limit")
|
raise newException(OverflowError, "RLPx message size exceeds limit")
|
||||||
|
|
||||||
# write the frame size in the first 3 bytes of the header
|
# write the frame size in the first 3 bytes of the header
|
||||||
header[0] = byte(msg.len shl 16)
|
header[0] = byte((msg.len shr 16) and 0xFF)
|
||||||
header[1] = byte(msg.len shl 8)
|
header[1] = byte((msg.len shr 8) and 0xFF)
|
||||||
header[2] = byte(msg.len)
|
header[2] = byte(msg.len and 0xFF)
|
||||||
|
|
||||||
# XXX:
|
# XXX:
|
||||||
# This would be safer if we use a thread-local sequ for the temporary buffer
|
# This would be safer if we use a thread-local sequ for the temporary buffer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user