mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
added tests
This commit is contained in:
@ -176,7 +176,9 @@ async def push_identify_to_peers(
|
||||
host: IHost,
|
||||
peer_ids: set[ID] | None = None,
|
||||
observed_multiaddr: Multiaddr | None = None,
|
||||
) -> None:
|
||||
counter: dict[str, int] | None = None,
|
||||
lock: trio.Lock | None = None,
|
||||
) -> int: # <-- return the max concurrency
|
||||
"""
|
||||
Push an identify message to multiple peers in parallel.
|
||||
|
||||
@ -191,3 +193,5 @@ async def push_identify_to_peers(
|
||||
async with trio.open_nursery() as nursery:
|
||||
for peer_id in peer_ids:
|
||||
nursery.start_soon(limited_push, peer_id)
|
||||
|
||||
return counter["max"] if counter else 0
|
||||
|
||||
@ -10,6 +10,7 @@ import trio
|
||||
from libp2p import (
|
||||
new_host,
|
||||
)
|
||||
from libp2p.abc import IHost
|
||||
from libp2p.crypto.secp256k1 import (
|
||||
create_new_key_pair,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user