Avoid hanging the caller when we try to claim from a dead peer

This commit is contained in:
Bryan Boreham committed 2015-07-16 16:12:23 +01:00
1 parent 2fa65f0a22
commit c3c40b15f1
2 files changed
+15 -1

No files matched your search

+5 -1
View File
@@ -45,7 +45,11 @@ func (c *claim) Try(alloc *Allocator) bool {
return false
default:
alloc.debugf("requesting address %s from other peer %s", c.addr, owner)
alloc.sendSpaceRequest(owner, address.NewRange(c.addr, 1))
err := alloc.sendSpaceRequest(owner, address.NewRange(c.addr, 1))
if err != nil { // can't speak to owner right now; figure it out later
alloc.infof("Claim %s for %s: %s; will try later.", c.addr, c.ident, err)
c.sendResult(nil)
}
return false
}
+10
View File
@@ -27,4 +27,14 @@ assert_raises "[ $C3 != $C1 ]"
assert_raises "exec_on $HOST1 c1 $PING $C3"
stop_router_on $HOST1
stop_router_on $HOST2
# Now make host1 attempt to claim from host2, when host2 is stopped
weave_on $HOST2 launch-router
# Introduce host3 to remember the IPAM CRDT when we stop host2
weave_on $HOST3 launch-router $HOST2
stop_router_on $HOST2
weave_on $HOST1 launch-router --log-level=debug $HOST3
end_suite