From d366530699a6b1af77727c5146e9b9eec267cc36 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Wed, 12 Oct 2016 10:02:18 +0200 Subject: [PATCH] clientlog: move status check to get_record() --- clientlog.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/clientlog.c b/clientlog.c index 83dc693..a9f2634 100644 --- a/clientlog.c +++ b/clientlog.c @@ -158,7 +158,7 @@ get_record(IPAddr *ip) time_t last_hit, oldest_hit = 0; Record *record, *oldest_record; - if (ip->family != IPADDR_INET4 && ip->family != IPADDR_INET6) + if (!active || (ip->family != IPADDR_INET4 && ip->family != IPADDR_INET6)) return NULL; while (1) { @@ -415,9 +415,6 @@ CLG_GetClientIndex(IPAddr *client) { Record *record; - if (!active) - return -1; - record = get_record(client); if (record == NULL) return -1; @@ -434,9 +431,6 @@ CLG_LogNTPAccess(IPAddr *client, struct timespec *now) total_ntp_hits++; - if (!active) - return -1; - record = get_record(client); if (record == NULL) return -1; @@ -464,9 +458,6 @@ CLG_LogCommandAccess(IPAddr *client, struct timespec *now) total_cmd_hits++; - if (!active) - return -1; - record = get_record(client); if (record == NULL) return -1;