FedP2P/tracker/udp/timeout.go

19 lines
284 B
Go

package udp
import (
"time"
)
const maxTimeout = 3840 * time.Second
func timeout(contiguousTimeouts int) (d time.Duration) {
if contiguousTimeouts > 8 {
contiguousTimeouts = 8
}
d = 15 * time.Second
for ; contiguousTimeouts > 0; contiguousTimeouts-- {
d *= 2
}
return
}