use Space.NumFreeAddresses for calculating transferred ip count
...rather than Space.NumFreeAddressesInRange; we don't care about the universe. Alternatively we could make Space.AddRanges return the count. But AddRanges doesn't know whether the ranges overlap with existing free space - that is only guaranteed by the context - so would have to do much the same before/after calculation. Another alternative would be to add the range sizes in AdminTakeoverRanges. But that is more code and less clear.
This commit is contained in:
1 parent
62d823850c
commit
9f10b21c9c
3 files changed
+10
-12
No files matched your search
+2
-2
@@ -403,9 +403,9 @@ func (alloc *Allocator) AdminTakeoverRanges(peerNameOrNickname string) address.C
|
||||
return
|
||||
}
|
||||
|
||||
before := alloc.space.NumFreeAddressesInRange(alloc.universe)
|
||||
before := alloc.space.NumFreeAddresses()
|
||||
alloc.space.AddRanges(newRanges)
|
||||
after := alloc.space.NumFreeAddressesInRange(alloc.universe)
|
||||
after := alloc.space.NumFreeAddresses()
|
||||
|
||||
alloc.gossip.GossipBroadcast(alloc.Gossip())
|
||||
|
||||
|
||||
Reference in new issue
Block a user