Subtract allocated channel slots from total
This commit is contained in:
parent
065fe94cbd
commit
20f59362ff
|
@ -60,6 +60,14 @@ def getChanFree(net, new):
|
|||
return False
|
||||
return (chanfree, chanlimits.pop())
|
||||
|
||||
def getTotalChans(net):
|
||||
total = 0
|
||||
for i in getActiveRelays(net):
|
||||
name = net + str(i)
|
||||
if name in main.IRCPool.keys():
|
||||
total += len(main.IRCPool[name].channels)
|
||||
return total
|
||||
|
||||
|
||||
def emptyChanAllocate(net, flist, new):
|
||||
chanfree = getChanFree(net, new)
|
||||
|
@ -161,7 +169,11 @@ def keepChannels(net, listinfo, mean, sigrelay, relay, chanlimit):
|
|||
error("Network %s is too big to cover: %i relays required" % (net, sigrelay))
|
||||
return
|
||||
num_instances = len(getActiveRelays(net))
|
||||
max_chans = chanlimit * num_instances
|
||||
debug(f"keepChannels() {net} instances:{num_instances} chanlimit:{chanlimit}")
|
||||
chan_slots_used = getTotalChans(net)
|
||||
debug(f"keepChannels() slots_used:{chan_slots_used}")
|
||||
max_chans = (chanlimit * num_instances) - chan_slots_used
|
||||
debug(f"keepChannels() max_chans:{max_chans}")
|
||||
if coverAll:
|
||||
needed = relay - len(getActiveRelays(net))
|
||||
debug(f"keepChannels() coverAll asking to provision {needed} relays for {net} relay:{relay}")
|
||||
|
|
Loading…
Reference in New Issue