From 2a02f92f776bf80ec8a996049c818b41a0854ad1 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Tue, 3 Sep 2019 21:59:09 -0700 Subject: [PATCH] Temporary porcelain until next PR --- libp2p/io/msgio.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libp2p/io/msgio.py b/libp2p/io/msgio.py index 4c23ef2..5e64b45 100644 --- a/libp2p/io/msgio.py +++ b/libp2p/io/msgio.py @@ -32,6 +32,16 @@ def encode_msg_with_length(msg_bytes: bytes) -> bytes: return len_prefix + msg_bytes +# NOTE: temporary for this PR +encode = encode_msg_with_length + + +# NOTE: temporary for this PR +async def read_next_message(reader: Reader) -> bytes: + length = await read_length(reader) + return await reader.read(length) + + class MsgIOWriter(Writer, Closer): write_closer: WriteCloser