mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-12-23 07:35:39 +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
|
// 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 {
|
||||||
backoff++
|
if backoff < 14 { // Cap at roughly 4.5 hours maximum.
|
||||||
|
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