Default protocols are constructed using a reference to the host
This commit is contained in:
parent
e0a94b6092
commit
693a8cf99a
|
@ -55,7 +55,7 @@ class BasicHost(IHost):
|
||||||
self._network.set_stream_handler(self._swarm_stream_handler)
|
self._network.set_stream_handler(self._swarm_stream_handler)
|
||||||
self.peerstore = self._network.peerstore
|
self.peerstore = self._network.peerstore
|
||||||
# Protocol muxing
|
# Protocol muxing
|
||||||
default_protocols = default_protocols or get_default_protocols()
|
default_protocols = default_protocols or get_default_protocols(self)
|
||||||
self.multiselect = Multiselect(default_protocols)
|
self.multiselect = Multiselect(default_protocols)
|
||||||
self.multiselect_client = MultiselectClient()
|
self.multiselect_client = MultiselectClient()
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from libp2p.host.host_interface import IHost
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from libp2p.typing import TProtocol, StreamHandlerFn
|
from libp2p.typing import TProtocol, StreamHandlerFn
|
||||||
|
|
||||||
DEFAULT_HOST_PROTOCOLS: "OrderedDict[TProtocol, StreamHandlerFn]" = OrderedDict()
|
|
||||||
|
|
||||||
|
def get_default_protocols(host: IHost) -> "OrderedDict[TProtocol, StreamHandlerFn]":
|
||||||
def get_default_protocols() -> "OrderedDict[TProtocol, StreamHandlerFn]":
|
return OrderedDict()
|
||||||
return DEFAULT_HOST_PROTOCOLS.copy()
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user