mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-05 17:05:50 +02:00
watchtower/wtclient/session_negotiator: don't backoff on first attempt
This commit is contained in:
@@ -228,7 +228,7 @@ func (n *sessionNegotiator) negotiate() {
|
|||||||
|
|
||||||
// On the first pass, initialize the backoff to our configured min
|
// On the first pass, initialize the backoff to our configured min
|
||||||
// backoff.
|
// backoff.
|
||||||
backoff := n.cfg.MinBackoff
|
var backoff time.Duration
|
||||||
|
|
||||||
retryWithBackoff:
|
retryWithBackoff:
|
||||||
// If we are retrying, wait out the delay before continuing.
|
// If we are retrying, wait out the delay before continuing.
|
||||||
@@ -244,13 +244,24 @@ retryWithBackoff:
|
|||||||
// iterator to ensure the results are fresh.
|
// iterator to ensure the results are fresh.
|
||||||
n.cfg.Candidates.Reset()
|
n.cfg.Candidates.Reset()
|
||||||
for {
|
for {
|
||||||
|
select {
|
||||||
|
case <-n.quit:
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
// Pull the next candidate from our list of addresses.
|
// Pull the next candidate from our list of addresses.
|
||||||
tower, err := n.cfg.Candidates.Next()
|
tower, err := n.cfg.Candidates.Next()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// We've run out of addresses, double and clamp backoff.
|
if backoff == 0 {
|
||||||
backoff *= 2
|
backoff = n.cfg.MinBackoff
|
||||||
if backoff > n.cfg.MaxBackoff {
|
} else {
|
||||||
backoff = n.cfg.MaxBackoff
|
// We've run out of addresses, double and clamp
|
||||||
|
// backoff.
|
||||||
|
backoff *= 2
|
||||||
|
if backoff > n.cfg.MaxBackoff {
|
||||||
|
backoff = n.cfg.MaxBackoff
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("Unable to get new tower candidate, "+
|
log.Debugf("Unable to get new tower candidate, "+
|
||||||
|
Reference in New Issue
Block a user