Add SpaceRequestDenied message

This commit is contained in:
Bryan Boreham committed 2015-07-16 16:12:23 +01:00
1 parent e7088e5daf
commit 2d224d423d
2 files changed
+45 -8

No files matched your search

+11 -6
View File
@@ -44,12 +44,9 @@ func (c *claim) Try(alloc *Allocator) bool {
c.sendResult(nil) // don't make the caller wait
return false
default:
name, found := alloc.nicknames[owner]
if found {
name = " (" + name + ")"
}
c.sendResult(fmt.Errorf("address %s is owned by other peer %s%s", c.addr.String(), owner, name))
return true
alloc.debugf("requesting address %s from other peer %s", c.addr, owner)
alloc.sendSpaceRequest(owner, address.NewRange(c.addr, 1))
return false
}
// We are the owner, check we haven't given it to another container
@@ -72,6 +69,14 @@ func (c *claim) Try(alloc *Allocator) bool {
return true
}
func (c *claim) DeniedBy(alloc *Allocator, owner router.PeerName) {
name, found := alloc.nicknames[owner]
if found {
name = " (" + name + ")"
}
c.sendResult(fmt.Errorf("address %s is owned by other peer %s%s", c.addr.String(), owner, name))
}
func (c *claim) Cancel() {
c.sendResult(fmt.Errorf("Operation cancelled."))
}