cleanup: estimators: simplify blindAdjust

This commit is contained in:
Markus Linnala 2019-10-15 17:44:22 +03:00 committed by Frank Denis
parent 111072dec5
commit c699e7bec4
1 changed files with 1 additions and 5 deletions

View File

@ -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()
}