Persist ring after updates caused by reportFreeSpace()

This commit is contained in:
Bryan Boreham committed 2016-06-08 11:52:38 +01:00
1 parent 6062627582
commit e2bee6e8c6
2 files changed
+7 -3

No files matched your search

+4 -2
View File
@@ -417,8 +417,8 @@ func (r *Ring) String() string {
// ReportFree is used by the allocator to tell the ring how many free
// ips are in a given range, so that ChoosePeersToAskForSpace can make
// more intelligent decisions.
func (r *Ring) ReportFree(freespace map[address.Address]address.Count) {
// more intelligent decisions. Returns true if any changes made.
func (r *Ring) ReportFree(freespace map[address.Address]address.Count) (updated bool) {
r.assertInvariants()
defer r.assertInvariants()
defer r.updateExportedVariables()
@@ -456,7 +456,9 @@ func (r *Ring) ReportFree(freespace map[address.Address]address.Count) {
entries[i].Free = free
entries[i].Version++
updated = true
}
return
}
type weightedPeer struct {