Extract lookup function for owned addresses
This commit is contained in:
1 parent
7d881a0f0c
commit
c27cd5b4ab
2 files changed
+18
-15
No files matched your search
+3
-8
@@ -24,14 +24,9 @@ func (g *allocate) Try(alloc *Allocator) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// If we have previously stored an address for this container in this subnet, return it.
|
||||
if addrs, found := alloc.owned[g.ident]; found {
|
||||
for _, addr := range addrs {
|
||||
if g.r.Contains(addr) {
|
||||
g.resultChan <- allocateResult{addr, nil}
|
||||
return true
|
||||
}
|
||||
}
|
||||
if addr, found := alloc.lookupOwned(g.ident, g.r); found {
|
||||
g.resultChan <- allocateResult{addr, nil}
|
||||
return true
|
||||
}
|
||||
|
||||
if !alloc.universe.Overlaps(g.r) {
|
||||
|
||||
Reference in new issue
Block a user