resolved: cache - clarify logging
authorTom Gundersen <teg@jklm.no>
Mon, 17 Aug 2015 06:38:48 +0000 (08:38 +0200)
committerTom Gundersen <teg@jklm.no>
Wed, 16 Sep 2015 15:03:17 +0000 (17:03 +0200)
src/resolve/resolved-dns-cache.c

index cbbbed8..05518c3 100644 (file)
@@ -277,13 +277,14 @@ static int dns_cache_put_positive(
 
         /* New TTL is 0? Delete the entry... */
         if (rr->ttl <= 0) {
-                if (dns_cache_remove(c, rr->key)) {
-                        r = dns_resource_key_to_string(rr->key, &key_str);
-                        if (r < 0)
-                                return r;
+                r = dns_resource_key_to_string(rr->key, &key_str);
+                if (r < 0)
+                        return r;
 
+                if (dns_cache_remove(c, rr->key))
                         log_debug("Removed zero TTL entry from cache: %s", key_str);
-                }
+                else
+                        log_debug("Not caching zero TTL cache entry: %s", key_str);
 
                 return 0;
         }
@@ -361,7 +362,7 @@ static int dns_cache_put_negative(
                 if (r < 0)
                         return r;
 
-                log_debug("Ignored negative cache entry with zero SOA TTL: %s", key_str);
+                log_debug("Not caching negative entry with zero SOA TTL: %s", key_str);
 
                 return 0;
         }