mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
fix: quic maddr test
This commit is contained in:
@ -199,9 +199,10 @@ def new_swarm(
|
|||||||
transport = TCP()
|
transport = TCP()
|
||||||
else:
|
else:
|
||||||
addr = listen_addrs[0]
|
addr = listen_addrs[0]
|
||||||
|
is_quic = addr.__contains__("quic") or addr.__contains__("quic-v1")
|
||||||
if addr.__contains__("tcp"):
|
if addr.__contains__("tcp"):
|
||||||
transport = TCP()
|
transport = TCP()
|
||||||
elif addr.__contains__("quic"):
|
elif is_quic:
|
||||||
transport_opt = transport_opt or {}
|
transport_opt = transport_opt or {}
|
||||||
quic_config = transport_opt.get('quic_config', QUICTransportConfig())
|
quic_config = transport_opt.get('quic_config', QUICTransportConfig())
|
||||||
transport = QUICTransport(key_pair.private_key, quic_config)
|
transport = QUICTransport(key_pair.private_key, quic_config)
|
||||||
|
|||||||
@ -365,6 +365,7 @@ async def test_yamux_stress_ping():
|
|||||||
await client_host.connect(info)
|
await client_host.connect(info)
|
||||||
|
|
||||||
async def ping_stream(i: int):
|
async def ping_stream(i: int):
|
||||||
|
stream = None
|
||||||
try:
|
try:
|
||||||
start = trio.current_time()
|
start = trio.current_time()
|
||||||
stream = await client_host.new_stream(
|
stream = await client_host.new_stream(
|
||||||
@ -384,7 +385,8 @@ async def test_yamux_stress_ping():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[Ping #{i}] Failed: {e}")
|
print(f"[Ping #{i}] Failed: {e}")
|
||||||
failures.append(i)
|
failures.append(i)
|
||||||
await stream.reset()
|
if stream:
|
||||||
|
await stream.reset()
|
||||||
|
|
||||||
async with trio.open_nursery() as nursery:
|
async with trio.open_nursery() as nursery:
|
||||||
for i in range(STREAM_COUNT):
|
for i in range(STREAM_COUNT):
|
||||||
|
|||||||
Reference in New Issue
Block a user