Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/ipam-ops-reentrant'
Browse files Browse the repository at this point in the history
  • Loading branch information
marccarre committed Apr 12, 2017
2 parents d6a5eae + 1c1b324 commit b753bcd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ipam/allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ func (alloc *Allocator) tryPendingOps() {
alloc.tryOps(&alloc.pendingAllocates)
}

func (alloc *Allocator) havePendingOps() bool {
return len(alloc.pendingPrimes)+len(alloc.pendingClaims)+len(alloc.pendingAllocates) > 0
}

func (alloc *Allocator) spaceRequestDenied(sender mesh.PeerName, r address.Range) {
for i := 0; i < len(alloc.pendingClaims); {
claim := alloc.pendingClaims[i].(*claim)
Expand Down Expand Up @@ -696,8 +700,12 @@ func (alloc *Allocator) actorLoop(actionChan <-chan func(), stopChan <-chan stru
// Retry things in case messages got lost between here and recipients
if alloc.awaitingConsensus {
alloc.propose()
} else {
alloc.tryPendingOps()
} else if alloc.havePendingOps() {
if alloc.ring.Empty() {
alloc.establishRing()
} else {
alloc.tryPendingOps()
}
}
alloc.removeDeadContainers()
}
Expand Down

0 comments on commit b753bcd

Please sign in to comment.