mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2024-12-27 00:12:31 +01:00
cleanup: estimators: simplify blindAdjust
This commit is contained in:
parent
111072dec5
commit
c699e7bec4
@ -29,11 +29,7 @@ func (questionSizeEstimator *QuestionSizeEstimator) MinQuestionSize() int {
|
||||
|
||||
func (questionSizeEstimator *QuestionSizeEstimator) blindAdjust() {
|
||||
questionSizeEstimator.Lock()
|
||||
if MaxDNSUDPPacketSize-questionSizeEstimator.minQuestionSize < questionSizeEstimator.minQuestionSize {
|
||||
questionSizeEstimator.minQuestionSize = MaxDNSUDPPacketSize
|
||||
} else {
|
||||
questionSizeEstimator.minQuestionSize *= 2
|
||||
}
|
||||
questionSizeEstimator.minQuestionSize = Min(MaxDNSUDPPacketSize, questionSizeEstimator.minQuestionSize*2)
|
||||
questionSizeEstimator.ewma.Set(float64(questionSizeEstimator.minQuestionSize))
|
||||
questionSizeEstimator.Unlock()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user