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() {
|
func (questionSizeEstimator *QuestionSizeEstimator) blindAdjust() {
|
||||||
questionSizeEstimator.Lock()
|
questionSizeEstimator.Lock()
|
||||||
if MaxDNSUDPPacketSize-questionSizeEstimator.minQuestionSize < questionSizeEstimator.minQuestionSize {
|
questionSizeEstimator.minQuestionSize = Min(MaxDNSUDPPacketSize, questionSizeEstimator.minQuestionSize*2)
|
||||||
questionSizeEstimator.minQuestionSize = MaxDNSUDPPacketSize
|
|
||||||
} else {
|
|
||||||
questionSizeEstimator.minQuestionSize *= 2
|
|
||||||
}
|
|
||||||
questionSizeEstimator.ewma.Set(float64(questionSizeEstimator.minQuestionSize))
|
questionSizeEstimator.ewma.Set(float64(questionSizeEstimator.minQuestionSize))
|
||||||
questionSizeEstimator.Unlock()
|
questionSizeEstimator.Unlock()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue