Skip to content

Commit 383d7cb

Browse files
committed
added tests
1 parent a89ba8e commit 383d7cb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

libp2p/identity/identify_push/identify_push.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ async def push_identify_to_peers(
176176
host: IHost,
177177
peer_ids: set[ID] | None = None,
178178
observed_multiaddr: Multiaddr | None = None,
179-
) -> None:
179+
counter: dict[str, int] | None = None,
180+
lock: trio.Lock | None = None,
181+
) -> int: # <-- return the max concurrency
180182
"""
181183
Push an identify message to multiple peers in parallel.
182184
@@ -191,3 +193,5 @@ async def push_identify_to_peers(
191193
async with trio.open_nursery() as nursery:
192194
for peer_id in peer_ids:
193195
nursery.start_soon(limited_push, peer_id)
196+
197+
return counter["max"] if counter else 0

tests/core/identity/identify_push/test_identify_push.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from libp2p import (
1111
new_host,
1212
)
13+
from libp2p.abc import IHost
1314
from libp2p.crypto.secp256k1 import (
1415
create_new_key_pair,
1516
)

0 commit comments

Comments
 (0)