From c5eda4065d5e3bdf08f9f79789b6e4de83b6da54 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Mon, 26 Aug 2019 11:38:39 -0700 Subject: [PATCH] Expose `reset` method on `NetStream` --- libp2p/network/stream/net_stream.py | 3 +++ libp2p/network/stream/net_stream_interface.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/libp2p/network/stream/net_stream.py b/libp2p/network/stream/net_stream.py index cac0d48..010bd92 100644 --- a/libp2p/network/stream/net_stream.py +++ b/libp2p/network/stream/net_stream.py @@ -50,3 +50,6 @@ class NetStream(INetStream): """ await self.muxed_stream.close() return True + + async def reset(self) -> bool: + return await self.muxed_stream.reset() diff --git a/libp2p/network/stream/net_stream_interface.py b/libp2p/network/stream/net_stream_interface.py index 43bbc53..4df95d8 100644 --- a/libp2p/network/stream/net_stream_interface.py +++ b/libp2p/network/stream/net_stream_interface.py @@ -42,3 +42,9 @@ class INetStream(ABC): close the underlying muxed stream :return: true if successful """ + + @abstractmethod + async def reset(self) -> bool: + """ + Close both ends of the stream. + """