Extra debugging for get_first_relay

This commit is contained in:
Mark Veidemanis 2022-08-13 23:14:17 +01:00
parent 65697ce8f0
commit e517d04095
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,6 @@
import main
from modules import chankeep
from util.logging.debug import debug
def get_first_relay(net):
"""
@ -11,13 +11,16 @@ def get_first_relay(net):
"""
cur_relay = 0
max_relay = len(main.network[net].relays.keys()) + 1
debug(f"get_first_relay() {net}: max_relay:{max_relay}")
activeRelays = chankeep.getActiveRelays(net)
debug(f"get_first_relay() {net}: activeRelays:{activeRelays}")
while cur_relay != max_relay:
cur_relay += 1
if cur_relay not in activeRelays:
continue
name = net + str(cur_relay)
if name in main.IRCPool.keys():
debug(f"get_first_relay() {net}: found relay {name}")
return main.IRCPool[name]
return None