mirror of
https://github.com/yggdrasil-network/yggdrasil-go
synced 2024-11-09 23:20:26 +03: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
|
// The caller should check the return value to decide whether
|
||||||
// or not to give up trying.
|
// or not to give up trying.
|
||||||
backoffNow := func() bool {
|
backoffNow := func() bool {
|
||||||
|
if backoff < 14 { // Cap at roughly 4.5 hours maximum.
|
||||||
backoff++
|
backoff++
|
||||||
|
}
|
||||||
duration := time.Second * time.Duration(math.Exp2(float64(backoff)))
|
duration := time.Second * time.Duration(math.Exp2(float64(backoff)))
|
||||||
select {
|
select {
|
||||||
case <-state.kick:
|
case <-state.kick:
|
||||||
|
Loading…
Reference in New Issue
Block a user