update with knits from davec and an additional one from me
This commit is contained in:
parent
568c0044a0
commit
1e77c8e554
1 changed files with 4 additions and 5 deletions
9
peer.go
9
peer.go
|
@ -1209,7 +1209,6 @@ func newOutboundPeer(s *server, addr string, persistent bool) *peer {
|
|||
log.Debugf("[SRVR] Attempting to connect to %s", faddr)
|
||||
conn, err := dial("tcp", addr)
|
||||
if err != nil {
|
||||
baseRetryInterval := time.Second * 10
|
||||
p.retrycount += 1
|
||||
log.Errorf("[SRVR] Failed to connect to %s: %v",
|
||||
faddr, err)
|
||||
|
@ -1218,11 +1217,11 @@ func newOutboundPeer(s *server, addr string, persistent bool) *peer {
|
|||
p.wg.Done()
|
||||
return
|
||||
}
|
||||
scaledRetryInterval := baseRetryInterval.Nanoseconds() * p.retrycount / 2
|
||||
scaledRetrySeconds := time.Duration(scaledRetryInterval)
|
||||
scaledInterval := connectionRetryInterval.Nanoseconds() * p.retrycount / 2
|
||||
scaledDuration := time.Duration(scaledInterval)
|
||||
log.Infof("[SRVR] Retrying connection to %s "+
|
||||
"in %v", faddr, scaledRetrySeconds)
|
||||
time.Sleep(scaledRetrySeconds)
|
||||
"in %s", faddr, scaledDuration)
|
||||
time.Sleep(scaledDuration)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue