Add connected status to IRC info return and check when getting active relays

This commit is contained in:
Mark Veidemanis 2022-08-13 13:40:33 +01:00
parent 6c92e8e7d9
commit 4d543f31ec
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 3 additions and 1 deletions

View File

@ -310,9 +310,11 @@ class API(object):
if name in main.IRCPool.keys(): if name in main.IRCPool.keys():
to_append["chans"] = len(main.IRCPool[name].channels) to_append["chans"] = len(main.IRCPool[name].channels)
to_append["nick"] = main.IRCPool[name].nickname to_append["nick"] = main.IRCPool[name].nickname
to_append["conn"] = main.IRCPool[name].isconnected
else: else:
to_append["chans"] = 0 to_append["chans"] = 0
to_append["nick"] = None to_append["nick"] = None
to_append["conn"] = False
relays.append(to_append) relays.append(to_append)
return dumps({"relays": relays}) return dumps({"relays": relays})

View File

@ -33,7 +33,7 @@ def allRelaysActive(net):
for i in activeRelays: for i in activeRelays:
name = net + str(i) name = net + str(i)
if name in main.IRCPool.keys(): if name in main.IRCPool.keys():
if main.IRCPool[name].authenticated: if main.IRCPool[name].authenticated and main.IRCPool[name].isconnected:
existNum += 1 existNum += 1
debug(f"allRelaysActive() finished, {existNum}/{relayNum} relays active for {net}") debug(f"allRelaysActive() finished, {existNum}/{relayNum} relays active for {net}")
if existNum == relayNum: if existNum == relayNum: