Add test and fix ci

This commit is contained in:
sukhman
2025-09-23 09:05:33 +05:30
parent 3363f57338
commit c8c7e55d5c
3 changed files with 82 additions and 4 deletions

View File

@ -508,7 +508,9 @@ class DCUtRProtocol(Service):
# Handle both single connection and list of connections
connections: list[INetConn] = (
[conn_or_conns] if not isinstance(conn_or_conns, list) else conn_or_conns
list(conn_or_conns)
if not isinstance(conn_or_conns, list)
else conn_or_conns
)
# Check if any connection is direct (not relayed)

View File

@ -90,7 +90,7 @@ class CircuitV2Transport(ITransport):
discovery_interval=config.discovery_interval,
max_relays=config.max_relays,
)
self.relay_counter = 0 # for round robin load balancing
self.relay_counter = 0 # for round robin load balancing
async def dial(
self,
@ -235,10 +235,10 @@ class CircuitV2Transport(ITransport):
self.relay_counter += 1
if relays_with_reservations:
return relays_with_reservations[
(self.relay_counter-1) % len(relays_with_reservations)
(self.relay_counter - 1) % len(relays_with_reservations)
]
elif other_relays:
return other_relays[(self.relay_counter-1) % len(other_relays)]
return other_relays[(self.relay_counter - 1) % len(other_relays)]
await trio.sleep(1)
attempts += 1