diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-01-11 18:57:59 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-01-11 19:40:00 +0100 |
commit | 011842775f750711833526d5bba1b818713947f5 (patch) | |
tree | b90a56737a40d83362a8bd8e42ce677dec562884 | |
parent | 372dd764a6be504eb4b1fbe326ab8fa6ce66fd5d (diff) |
resolved: split out resetting of DNS server counters into a function call of its own
A suggested by Vito Caputo:
https://github.com/systemd/systemd/pull/2289#discussion-diff-49276220
-rw-r--r-- | src/resolve/resolved-dns-server.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/resolve/resolved-dns-server.c b/src/resolve/resolved-dns-server.c index 2a0301aa49..0969e31e8a 100644 --- a/src/resolve/resolved-dns-server.c +++ b/src/resolve/resolved-dns-server.c @@ -344,6 +344,16 @@ static bool dns_server_grace_period_expired(DnsServer *s) { return true; } +static void dns_server_reset_counters(DnsServer *s) { + assert(s); + + s->n_failed_udp = 0; + s->n_failed_tcp = 0; + s->packet_failed = false; + s->packet_truncated = false; + s->verified_usec = 0; +} + DnsServerFeatureLevel dns_server_possible_feature_level(DnsServer *s) { assert(s); @@ -351,13 +361,10 @@ DnsServerFeatureLevel dns_server_possible_feature_level(DnsServer *s) { dns_server_grace_period_expired(s)) { s->possible_feature_level = DNS_SERVER_FEATURE_LEVEL_BEST; - s->n_failed_udp = 0; - s->n_failed_tcp = 0; - s->packet_failed = false; - s->packet_truncated = false; - s->verified_usec = 0; s->rrsig_missing = false; + dns_server_reset_counters(s); + log_info("Grace period over, resuming full feature set (%s) for DNS server %s", dns_server_feature_level_to_string(s->possible_feature_level), dns_server_string(s)); @@ -405,11 +412,7 @@ DnsServerFeatureLevel dns_server_possible_feature_level(DnsServer *s) { if (p != s->possible_feature_level) { /* We changed the feature level, reset the counting */ - s->n_failed_udp = 0; - s->n_failed_tcp = 0; - s->packet_failed = false; - s->packet_truncated = false; - s->verified_usec = 0; + dns_server_reset_counters(s); log_warning("Using degraded feature set (%s) for DNS server %s", dns_server_feature_level_to_string(s->possible_feature_level), |