mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Avoid hard-coding ports where it is not relevant for Kademlia tests
This commit is contained in:
@ -45,7 +45,10 @@ async def set_up_nodes_by_transport_and_disc_opt(transport_disc_opt_list):
|
||||
return tuple(nodes_list)
|
||||
|
||||
|
||||
async def set_up_routers(router_confs):
|
||||
async def set_up_routers(router_confs=[0, 0]):
|
||||
"""
|
||||
The default ``router_confs`` selects two free ports local to this machine.
|
||||
"""
|
||||
bootstrap_node = KademliaServer()
|
||||
await bootstrap_node.listen(router_confs[0])
|
||||
|
||||
@ -54,7 +57,7 @@ async def set_up_routers(router_confs):
|
||||
node = KademliaServer()
|
||||
await node.listen(port)
|
||||
|
||||
await node.bootstrap_node(("127.0.0.1", router_confs[0]))
|
||||
await node.bootstrap_node(bootstrap_node.address)
|
||||
routers.append(KadmeliaPeerRouter(node))
|
||||
return routers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user