added peer-store cleanup task in ping example

This commit is contained in:
lla-dane
2025-07-19 23:06:15 +05:30
parent 09e151aafc
commit 64bc388b33
2 changed files with 7 additions and 0 deletions

View File

@ -59,6 +59,9 @@ async def run(port: int, destination: str) -> None:
host = new_host(listen_addrs=[listen_addr])
async with host.run(listen_addrs=[listen_addr]), trio.open_nursery() as nursery:
# Start the peer-store cleanup task
nursery.start_soon(host.get_peerstore().start_cleanup_task, 60)
if not destination:
host.set_stream_handler(PING_PROTOCOL_ID, handle_ping)