plugin/forward: min and max for avgRTT (#1680)
* Move to readtimeout * lets compile * address comment * comment from pr * much smaller minimum
This commit is contained in:
parent
cd7928f180
commit
573ad62b77
2 changed files with 8 additions and 2 deletions
|
@ -18,10 +18,14 @@ import (
|
|||
|
||||
func (p *Proxy) readTimeout() time.Duration {
|
||||
rtt := time.Duration(atomic.LoadInt64(&p.avgRtt))
|
||||
if rtt < timeout/2 {
|
||||
|
||||
if rtt < minTimeout {
|
||||
return minTimeout
|
||||
}
|
||||
if rtt < maxTimeout/2 {
|
||||
return 2 * rtt
|
||||
}
|
||||
return timeout
|
||||
return maxTimeout
|
||||
}
|
||||
|
||||
func (p *Proxy) updateRtt(newRtt time.Duration) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue