Keep trying peers to ask for space until we find one that doesn't error

This commit is contained in:
Bryan Boreham committed 2015-06-25 12:47:38 +01:00
1 parent 9f784b3c31
commit af9668f130
3 files changed
+40 -35

No files matched your search

+5 -2
View File
@@ -42,9 +42,12 @@ func (g *allocate) Try(alloc *Allocator) bool {
}
// out of space
if donor, err := alloc.ring.ChoosePeerToAskForSpace(g.r.Start, g.r.End); err == nil {
donors := alloc.ring.ChoosePeersToAskForSpace(g.r.Start, g.r.End)
for _, donor := range donors {
alloc.debugln("Decided to ask peer", donor, "for space in range", g.r)
alloc.sendSpaceRequest(donor, g.r)
if err := alloc.sendSpaceRequest(donor, g.r); err == nil {
break
}
}
return false