mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 16:49:57 +00:00
TUN-2921: Rework address selection logic to avoid corner cases
This commit is contained in:
@@ -100,7 +100,7 @@ func (ed *Edge) GetAddr(connID int) (*net.TCPAddr, error) {
|
||||
logger.Debug("No addresses left to give proxy connection")
|
||||
return nil, errNoAddressesLeft
|
||||
}
|
||||
logger.Debug("Giving connection its new address")
|
||||
logger.Debugf("Giving connection its new address %s", addr)
|
||||
return addr, nil
|
||||
}
|
||||
|
||||
@@ -120,9 +120,10 @@ func (ed *Edge) GetDifferentAddr(connID int) (*net.TCPAddr, error) {
|
||||
addr := ed.regions.GetUnusedAddr(oldAddr, connID)
|
||||
if addr == nil {
|
||||
logger.Debug("No addresses left to give proxy connection")
|
||||
// note: if oldAddr were not nil, it will become available on the next iteration
|
||||
return nil, errNoAddressesLeft
|
||||
}
|
||||
logger.Debug("Giving connection its new address")
|
||||
logger.Debugf("Giving connection its new address %s", addr)
|
||||
return addr, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user