mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2025-12-27 03:49:54 +00:00
StatsManager: updated code to support new response types.
This commit is contained in:
@@ -1537,10 +1537,21 @@ namespace DnsServerCore.Dns
|
||||
switch (responseCode)
|
||||
{
|
||||
case DnsResponseCode.NoError:
|
||||
if ((query is not null) && (responseType != DnsServerResponseType.Blocked)) //skip blocked domains
|
||||
if (query is not null)
|
||||
{
|
||||
_queryDomains.GetOrAdd(query.Name.ToLower(), GetNewCounter).Increment();
|
||||
_queries.GetOrAdd(query, GetNewCounter).Increment();
|
||||
switch (responseType)
|
||||
{
|
||||
case DnsServerResponseType.Blocked:
|
||||
case DnsServerResponseType.UpstreamBlocked:
|
||||
case DnsServerResponseType.CacheBlocked:
|
||||
//skip blocked domains
|
||||
break;
|
||||
|
||||
default:
|
||||
_queryDomains.GetOrAdd(query.Name.ToLower(), GetNewCounter).Increment();
|
||||
_queries.GetOrAdd(query, GetNewCounter).Increment();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Interlocked.Increment(ref _totalNoError);
|
||||
@@ -1585,6 +1596,24 @@ namespace DnsServerCore.Dns
|
||||
|
||||
Interlocked.Increment(ref _totalBlocked);
|
||||
break;
|
||||
|
||||
case DnsServerResponseType.UpstreamBlocked:
|
||||
Interlocked.Increment(ref _totalRecursive);
|
||||
|
||||
if (query is not null)
|
||||
_queryBlockedDomains.GetOrAdd(query.Name.ToLower(), GetNewCounter).Increment();
|
||||
|
||||
Interlocked.Increment(ref _totalBlocked);
|
||||
break;
|
||||
|
||||
case DnsServerResponseType.CacheBlocked:
|
||||
Interlocked.Increment(ref _totalCached);
|
||||
|
||||
if (query is not null)
|
||||
_queryBlockedDomains.GetOrAdd(query.Name.ToLower(), GetNewCounter).Increment();
|
||||
|
||||
Interlocked.Increment(ref _totalBlocked);
|
||||
break;
|
||||
}
|
||||
|
||||
if (query is not null)
|
||||
|
||||
Reference in New Issue
Block a user