diff --git a/DnsServerCore/Dns/DnsServer.cs b/DnsServerCore/Dns/DnsServer.cs index dcd44ca9..20d21c36 100644 --- a/DnsServerCore/Dns/DnsServer.cs +++ b/DnsServerCore/Dns/DnsServer.cs @@ -172,8 +172,8 @@ namespace DnsServerCore.Dns Timer _qpmLimitSamplingTimer; readonly object _qpmLimitSamplingTimerLock = new object(); const int QPM_LIMIT_SAMPLING_TIMER_INTERVAL = 10000; - IReadOnlyDictionary _qpmLimitClientSubnetStats; - IReadOnlyDictionary _qpmLimitErrorClientSubnetStats; + IReadOnlyDictionary _qpmLimitClientSubnetStats; + IReadOnlyDictionary _qpmLimitErrorClientSubnetStats; readonly IndependentTaskScheduler _resolverTaskScheduler = new IndependentTaskScheduler(ThreadPriority.AboveNormal); readonly DomainTree> _resolverTasks = new DomainTree>(); @@ -2746,11 +2746,11 @@ namespace DnsServerCore.Dns { try { - List> eligibleQueries = _stats.GetLastHourEligibleQueries(_cachePrefetchSampleEligibilityHitsPerHour); + List> eligibleQueries = _stats.GetLastHourEligibleQueries(_cachePrefetchSampleEligibilityHitsPerHour); List cacheRefreshSampleList = new List(eligibleQueries.Count); int cacheRefreshTrigger = (_cachePrefetchSampleIntervalInMinutes + 1) * 60; - foreach (KeyValuePair eligibleQuery in eligibleQueries) + foreach (KeyValuePair eligibleQuery in eligibleQueries) { DnsQuestionRecord eligibleQuerySample = eligibleQuery.Key; @@ -2964,16 +2964,16 @@ namespace DnsServerCore.Dns throw new NotSupportedException("AddressFamily not supported."); } - if ((_qpmLimitErrors > 0) && (_qpmLimitErrorClientSubnetStats is not null) && _qpmLimitErrorClientSubnetStats.TryGetValue(remoteSubnet, out int errorCountPerSample)) + if ((_qpmLimitErrors > 0) && (_qpmLimitErrorClientSubnetStats is not null) && _qpmLimitErrorClientSubnetStats.TryGetValue(remoteSubnet, out long errorCountPerSample)) { - int averageErrorCountPerMinute = errorCountPerSample / _qpmLimitSampleMinutes; + long averageErrorCountPerMinute = errorCountPerSample / _qpmLimitSampleMinutes; if (averageErrorCountPerMinute >= _qpmLimitErrors) return true; } - if ((_qpmLimitRequests > 0) && (_qpmLimitClientSubnetStats is not null) && _qpmLimitClientSubnetStats.TryGetValue(remoteSubnet, out int countPerSample)) + if ((_qpmLimitRequests > 0) && (_qpmLimitClientSubnetStats is not null) && _qpmLimitClientSubnetStats.TryGetValue(remoteSubnet, out long countPerSample)) { - int averageCountPerMinute = countPerSample / _qpmLimitSampleMinutes; + long averageCountPerMinute = countPerSample / _qpmLimitSampleMinutes; if (averageCountPerMinute >= _qpmLimitRequests) return true; }