mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-12-22 07:57:31 +00:00
Cap link backoff at roughly 4.5 hours
This commit is contained in:
parent
abec2256ae
commit
a0b3897278
@ -235,7 +235,9 @@ func (l *links) add(u *url.URL, sintf string, linkType linkType) error {
|
||||
// The caller should check the return value to decide whether
|
||||
// or not to give up trying.
|
||||
backoffNow := func() bool {
|
||||
backoff++
|
||||
if backoff < 14 { // Cap at roughly 4.5 hours maximum.
|
||||
backoff++
|
||||
}
|
||||
duration := time.Second * time.Duration(math.Exp2(float64(backoff)))
|
||||
select {
|
||||
case <-state.kick:
|
||||
|
Loading…
x
Reference in New Issue
Block a user