1
0
mirror of https://github.com/DNSCrypt/dnscrypt-proxy.git synced 2024-12-27 00:12:31 +01:00

Revert "cleanup: estimators: simplify blindAdjust"

This reverts commit c699e7bec4.
This commit is contained in:
Frank Denis 2019-11-05 01:16:22 +01:00
parent 17a675021e
commit b76db70a6c

View File

@ -29,7 +29,11 @@ func (questionSizeEstimator *QuestionSizeEstimator) MinQuestionSize() int {
func (questionSizeEstimator *QuestionSizeEstimator) blindAdjust() {
questionSizeEstimator.Lock()
questionSizeEstimator.minQuestionSize = Min(MaxDNSUDPPacketSize, questionSizeEstimator.minQuestionSize*2)
if MaxDNSUDPPacketSize-questionSizeEstimator.minQuestionSize < questionSizeEstimator.minQuestionSize {
questionSizeEstimator.minQuestionSize = MaxDNSUDPPacketSize
} else {
questionSizeEstimator.minQuestionSize *= 2
}
questionSizeEstimator.ewma.Set(float64(questionSizeEstimator.minQuestionSize))
questionSizeEstimator.Unlock()
}