commit 867659ab56bd7480508a2b56725b91579db4c0f1
parent 669ca3b710bf790efaaa85dad4561d7790713d88
Author: Frederic Cambus <fred@statdns.com>
Date: Wed, 13 Jan 2016 18:39:07 +0100
Increment IPv4 and IPv6 hits counters individually and conditionally
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/logswan.c b/src/logswan.c
@@ -142,6 +142,9 @@ int main (int argc, char *argv[]) {
if (isIPv4 || isIPv6) {
if (isIPv4) {
+ /* Increment hits counter */
+ results.hitsIPv4++;
+
/* Unique visitors */
hll_add(&uniqueIPv4, parsedLine.remoteHost, strlen(parsedLine.remoteHost));
@@ -151,6 +154,9 @@ int main (int argc, char *argv[]) {
}
if (isIPv6) {
+ /* Increment hits counter */
+ results.hitsIPv6++;
+
/* Unique visitors */
hll_add(&uniqueIPv6, parsedLine.remoteHost, strlen(parsedLine.remoteHost));
@@ -223,10 +229,6 @@ int main (int argc, char *argv[]) {
results.bandwidth += bandwidth;
}
}
-
- /* Increment hits counter */
- results.hitsIPv4 += isIPv4;
- results.hitsIPv6 += isIPv6;
} else {
/* Invalid line */
results.invalidLines++;