From 6e3857c89a2df245412b5af8ea2c063bcadb639b Mon Sep 17 00:00:00 2001 From: Robert Zajac Date: Mon, 12 Nov 2018 12:26:11 -0500 Subject: [PATCH] message read length fix --- muxer/mplex/muxed_connection.py | 4 ++-- muxer/mplex/utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/muxer/mplex/muxed_connection.py b/muxer/mplex/muxed_connection.py index 0ecb69e..5794289 100644 --- a/muxer/mplex/muxed_connection.py +++ b/muxer/mplex/muxed_connection.py @@ -92,9 +92,9 @@ class MuxedConn(IMuxedConn): data += chunk header, end_index = decode_uvarint(data, 0) - length, end_index = decode_uvarint(data, end_index + 1) + length, end_index = decode_uvarint(data, end_index) - message = data[-length:] + message = data[end_index:end_index + length + 1] # Deal with other types of messages flag = header & 0x07 diff --git a/muxer/mplex/utils.py b/muxer/mplex/utils.py index 4e20241..824ad93 100644 --- a/muxer/mplex/utils.py +++ b/muxer/mplex/utils.py @@ -22,4 +22,4 @@ def decode_uvarint(buff, index): break index += 1 - return result, index + return result, index + 1