From c699e7bec4405f232356e93e38d40e2bbfc76d24 Mon Sep 17 00:00:00 2001 From: Markus Linnala Date: Tue, 15 Oct 2019 17:44:22 +0300 Subject: [PATCH] cleanup: estimators: simplify blindAdjust --- dnscrypt-proxy/estimators.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/dnscrypt-proxy/estimators.go b/dnscrypt-proxy/estimators.go index 461be79e..47ca6ffd 100644 --- a/dnscrypt-proxy/estimators.go +++ b/dnscrypt-proxy/estimators.go @@ -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() }