mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-09 08:01:31 +00:00
todo handle data out of sync
This commit is contained in:
@@ -52,7 +52,7 @@ func (ipp *ConsensusIPPool) DomainForIP(from tailcfg.NodeID, addr netip.Addr, up
|
|||||||
defer pm.mu.Unlock()
|
defer pm.mu.Unlock()
|
||||||
ww, ok := pm.addrToDomain.Lookup(addr)
|
ww, ok := pm.addrToDomain.Lookup(addr)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Printf("DomainForIP: peer state doesn't recognize domain")
|
log.Printf("DomainForIP: peer state doesn't recognize addr: %s", addr)
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
@@ -268,11 +268,14 @@ func (ipp *ConsensusIPPool) applyCheckoutAddr(nid tailcfg.NodeID, domain string,
|
|||||||
addrToDomain: &bart.Table[whereWhen]{},
|
addrToDomain: &bart.Table[whereWhen]{},
|
||||||
})
|
})
|
||||||
if existing, ok := pm.domainToAddr[domain]; ok {
|
if existing, ok := pm.domainToAddr[domain]; ok {
|
||||||
// TODO (fran) handle error case where this doesn't exist
|
ww, ok := pm.addrToDomain.Lookup(existing)
|
||||||
ww, _ := pm.addrToDomain.Lookup(existing)
|
if ok {
|
||||||
ww.LastUsed = updatedAt
|
ww.LastUsed = updatedAt
|
||||||
pm.addrToDomain.Insert(netip.PrefixFrom(existing, existing.BitLen()), ww)
|
pm.addrToDomain.Insert(netip.PrefixFrom(existing, existing.BitLen()), ww)
|
||||||
return existing, nil
|
return existing, nil
|
||||||
|
} else {
|
||||||
|
log.Printf("applyCheckoutAddr: data out of sync, allocating new IP")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
addr, wasInUse, previousDomain, err := pm.unusedIPV4(ipp.IPSet, reuseDeadline)
|
addr, wasInUse, previousDomain, err := pm.unusedIPV4(ipp.IPSet, reuseDeadline)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user