Fix joining channels with inactive relays

This commit is contained in:
Mark Veidemanis 2022-07-29 17:28:09 +01:00
parent ba1f8407d1
commit 6359918639
2 changed files with 14 additions and 13 deletions

View File

@ -38,6 +38,10 @@ def getChanFree(net, new):
if i in new:
continue
name = net + str(i)
if name not in main.IRCPool.keys():
continue
if not main.IRCPool[name].isconnected:
continue
chanfree[i] = main.IRCPool[name].chanlimit - len(main.IRCPool[name].channels)
chanlimits.add(main.IRCPool[name].chanlimit)
if not len(chanlimits) == 1:
@ -131,8 +135,6 @@ def keepChannels(net, listinfo, mean, sigrelay, relay):
def joinSingle(net, channel):
if allRelaysActive(net):
# Use the algorithm to allocate our channel to a relay
eca = emptyChanAllocate(net, [channel], None, [])
if not len(eca.keys()) == 1:
return False
@ -142,9 +144,6 @@ def joinSingle(net, channel):
return False
main.IRCPool[name].join(channel)
return num
else:
error("All relays for %s are not active" % net)
return False
def partSingle(net, channel):

View File

@ -24,6 +24,8 @@ class Network:
self.aliases = {}
def add_relay(self, num=None):
# Grrrrrrrrrr
self.last = int(self.last)
if not num:
num = self.last
self.last += 1