From 4f7bb30d827d6b91bef9da754d1435df4878df18 Mon Sep 17 00:00:00 2001 From: mhchia Date: Tue, 3 Sep 2019 22:59:44 +0800 Subject: [PATCH] Add `INetStream` to type `StreamReader` TODO: Make stream readers implement `Reader` --- libp2p/network/stream/net_stream.py | 1 + libp2p/typing.py | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libp2p/network/stream/net_stream.py b/libp2p/network/stream/net_stream.py index 010bd92..ff78f5a 100644 --- a/libp2p/network/stream/net_stream.py +++ b/libp2p/network/stream/net_stream.py @@ -7,6 +7,7 @@ from .net_stream_interface import INetStream class NetStream(INetStream): muxed_stream: IMuxedStream + # TODO: Why we expose `mplex_conn` here? mplex_conn: IMuxedConn protocol_id: TProtocol diff --git a/libp2p/typing.py b/libp2p/typing.py index f36d8ab..ba776e1 100644 --- a/libp2p/typing.py +++ b/libp2p/typing.py @@ -9,5 +9,4 @@ if TYPE_CHECKING: TProtocol = NewType("TProtocol", str) StreamHandlerFn = Callable[["INetStream"], Awaitable[None]] - -StreamReader = Union["IMuxedStream", IRawConnection] +StreamReader = Union["IMuxedStream", "INetStream", IRawConnection]