mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-09 14:40:53 +00:00
Apply PR feedback
This commit is contained in:
@ -67,7 +67,7 @@ class INetwork(ABC):
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def listen(self, *args: Multiaddr) -> bool:
|
||||
async def listen(self, *args: Sequence[Multiaddr]) -> bool:
|
||||
"""
|
||||
:param *args: one or many multiaddrs to start listening on
|
||||
:return: True if at least one success
|
||||
|
||||
@ -18,11 +18,11 @@ from libp2p.protocol_muxer.multiselect import Multiselect
|
||||
from libp2p.protocol_muxer.multiselect_client import MultiselectClient
|
||||
from libp2p.routing.interfaces import IPeerRouting
|
||||
from libp2p.stream_muxer.muxed_connection_interface import IMuxedConn
|
||||
from libp2p.stream_muxer.muxed_stream_interface import IMuxedStream
|
||||
from libp2p.transport.upgrader import TransportUpgrader
|
||||
from libp2p.transport.transport_interface import ITransport
|
||||
from libp2p.transport.listener_interface import IListener
|
||||
|
||||
from libp2p.stream_muxer.mplex.mplex_stream import MplexStream
|
||||
|
||||
from .network_interface import INetwork
|
||||
from .notifee_interface import INotifee
|
||||
@ -168,7 +168,7 @@ class Swarm(INetwork):
|
||||
|
||||
return net_stream
|
||||
|
||||
async def listen(self, *args: Multiaddr) -> bool:
|
||||
async def listen(self, *args: Sequence[Multiaddr]) -> bool:
|
||||
"""
|
||||
:param *args: one or many multiaddrs to start listening on
|
||||
:return: true if at least one success
|
||||
@ -252,7 +252,7 @@ class Swarm(INetwork):
|
||||
# TODO: `disconnect`?
|
||||
|
||||
|
||||
GenericProtocolHandlerFn = Callable[[MplexStream], Awaitable[None]]
|
||||
GenericProtocolHandlerFn = Callable[[IMuxedStream], Awaitable[None]]
|
||||
|
||||
|
||||
def create_generic_protocol_handler(swarm: Swarm) -> GenericProtocolHandlerFn:
|
||||
@ -264,7 +264,7 @@ def create_generic_protocol_handler(swarm: Swarm) -> GenericProtocolHandlerFn:
|
||||
"""
|
||||
multiselect = swarm.multiselect
|
||||
|
||||
async def generic_protocol_handler(muxed_stream: MplexStream) -> None:
|
||||
async def generic_protocol_handler(muxed_stream: IMuxedStream) -> None:
|
||||
# Perform protocol muxing to determine protocol to use
|
||||
protocol, handler = await multiselect.negotiate(muxed_stream)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user