Agent: Simplify relay disconnect logic in network/relay/utils.py

This commit is contained in:
Shreya Malviya 2022-09-27 13:06:29 +05:30
parent 441c14f15d
commit d1199fdab2
1 changed files with 3 additions and 6 deletions

View File

@ -79,18 +79,15 @@ def _check_if_island_server(
def send_remove_from_waitlist_control_message_to_relays(servers: Iterable[str]):
for i, server in enumerate(servers, start=1):
server_address = SocketAddress.from_string(server)
t = create_daemon_thread(
target=_send_remove_from_waitlist_control_message_to_relay,
target=notify_disconnect,
name=f"SendRemoveFromWaitlistControlMessageToRelaysThread-{i:02d}",
args=(server,),
args=(server_address,),
)
t.start()
def _send_remove_from_waitlist_control_message_to_relay(server: str):
notify_disconnect(SocketAddress.from_string(server))
def notify_disconnect(server_address: SocketAddress):
"""
Tell upstream relay that we no longer need the relay