Fix joining channels with inactive relays
This commit is contained in:
parent
ba1f8407d1
commit
6359918639
|
@ -38,6 +38,10 @@ def getChanFree(net, new):
|
||||||
if i in new:
|
if i in new:
|
||||||
continue
|
continue
|
||||||
name = net + str(i)
|
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)
|
chanfree[i] = main.IRCPool[name].chanlimit - len(main.IRCPool[name].channels)
|
||||||
chanlimits.add(main.IRCPool[name].chanlimit)
|
chanlimits.add(main.IRCPool[name].chanlimit)
|
||||||
if not len(chanlimits) == 1:
|
if not len(chanlimits) == 1:
|
||||||
|
@ -131,20 +135,15 @@ def keepChannels(net, listinfo, mean, sigrelay, relay):
|
||||||
|
|
||||||
|
|
||||||
def joinSingle(net, channel):
|
def joinSingle(net, channel):
|
||||||
if allRelaysActive(net):
|
eca = emptyChanAllocate(net, [channel], None, [])
|
||||||
# Use the algorithm to allocate our channel to a relay
|
if not len(eca.keys()) == 1:
|
||||||
eca = emptyChanAllocate(net, [channel], None, [])
|
|
||||||
if not len(eca.keys()) == 1:
|
|
||||||
return False
|
|
||||||
num = list(eca.keys())[0]
|
|
||||||
name = f"{net}{num}"
|
|
||||||
if name not in main.IRCPool:
|
|
||||||
return False
|
|
||||||
main.IRCPool[name].join(channel)
|
|
||||||
return num
|
|
||||||
else:
|
|
||||||
error("All relays for %s are not active" % net)
|
|
||||||
return False
|
return False
|
||||||
|
num = list(eca.keys())[0]
|
||||||
|
name = f"{net}{num}"
|
||||||
|
if name not in main.IRCPool:
|
||||||
|
return False
|
||||||
|
main.IRCPool[name].join(channel)
|
||||||
|
return num
|
||||||
|
|
||||||
|
|
||||||
def partSingle(net, channel):
|
def partSingle(net, channel):
|
||||||
|
|
|
@ -24,6 +24,8 @@ class Network:
|
||||||
self.aliases = {}
|
self.aliases = {}
|
||||||
|
|
||||||
def add_relay(self, num=None):
|
def add_relay(self, num=None):
|
||||||
|
# Grrrrrrrrrr
|
||||||
|
self.last = int(self.last)
|
||||||
if not num:
|
if not num:
|
||||||
num = self.last
|
num = self.last
|
||||||
self.last += 1
|
self.last += 1
|
||||||
|
|
Loading…
Reference in New Issue