Refactor multiselect out of Swarm to BasicHost

This commit is contained in:
mhchia
2019-09-12 14:30:39 +08:00
parent 0bd213bbb7
commit 6cb033fd1f
5 changed files with 50 additions and 84 deletions

View File

@ -37,15 +37,6 @@ class INetwork(ABC):
:return: muxed connection
"""
@abstractmethod
def set_stream_handler(
self, protocol_id: TProtocol, stream_handler: StreamHandlerFn
) -> None:
"""
:param protocol_id: protocol id used on stream
:param stream_handler: a stream handler instance
"""
@abstractmethod
async def new_stream(
self, peer_id: ID, protocol_ids: Sequence[TProtocol]
@ -56,6 +47,12 @@ class INetwork(ABC):
:return: net stream instance
"""
@abstractmethod
def set_stream_handler(self, stream_handler: StreamHandlerFn) -> None:
"""
Set the stream handler for all incoming streams.
"""
@abstractmethod
async def listen(self, *multiaddrs: Sequence[Multiaddr]) -> bool:
"""