]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: If auth cache lookup results in expired entry, it should be tracked in stats...
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 5 Feb 2016 13:48:25 +0000 (15:48 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 5 Feb 2016 13:48:25 +0000 (15:48 +0200)
src/auth/auth-cache.c

index 16ce9db00f74ef996a5ce3e1d25b42dd2437e2d7..7608ac8d0e0142c84b070f442de2eb189d1f7074 100644 (file)
@@ -373,7 +373,6 @@ auth_cache_lookup(struct auth_cache *cache, const struct auth_request *request,
                cache->miss_count++;
                return NULL;
        }
-       cache->hit_count++;
 
        value = node->data + strlen(node->data) + 1;
        ttl_secs = *value == '\0' ? cache->neg_ttl_secs : cache->ttl_secs;
@@ -381,6 +380,7 @@ auth_cache_lookup(struct auth_cache *cache, const struct auth_request *request,
        now = time(NULL);
        if (node->created < now - (time_t)ttl_secs) {
                /* TTL expired */
+               cache->miss_count++;
                *expired_r = TRUE;
        } else {
                /* move to head */
@@ -388,6 +388,7 @@ auth_cache_lookup(struct auth_cache *cache, const struct auth_request *request,
                        auth_cache_node_unlink(cache, node);
                        auth_cache_node_link_head(cache, node);
                }
+               cache->hit_count++;
        }
        if (node->created < now - (time_t)cache->neg_ttl_secs)
                *neg_expired_r = TRUE;