From 424eab864a9f290d4a7638e0af03831429d48da8 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 7 Dec 2009 11:50:02 +0100 Subject: [PATCH] openvpn plugin: Remove one level of indentation in the read functions. --- src/openvpn.c | 72 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/src/openvpn.c b/src/openvpn.c index c71071c0..2d460d96 100644 --- a/src/openvpn.c +++ b/src/openvpn.c @@ -301,31 +301,29 @@ static int multi2_read (char *name, FILE *fh) * with more or less fields. */ if (fields_num != 8) - { continue; + + if (strcmp (fields[0], "CLIENT_LIST") != 0) + continue; + + if (new_naming_schema) + { + /* plugin inst = file name, type inst = fields[1] */ + iostats_submit (name, /* vpn instance */ + fields[1], /* "Common Name" */ + atoll (fields[4]), /* "Bytes Received" */ + atoll (fields[5])); /* "Bytes Sent" */ } else { - if (strcmp (fields[0], "CLIENT_LIST") == 0) - { - if (new_naming_schema) - { - iostats_submit (name, /* vpn instance */ - fields[1], /* "Common Name" */ - atoll (fields[4]), /* "Bytes Received" */ - atoll (fields[5])); /* "Bytes Sent" */ - } - else - { - iostats_submit (fields[1], /* "Common Name" */ - NULL, /* unused when in multimode */ - atoll (fields[4]), /* "Bytes Received" */ - atoll (fields[5])); /* "Bytes Sent" */ - } - - read = 1; - } + /* plugin inst = fields[1], type inst = "" */ + iostats_submit (fields[1], /* "Common Name" */ + NULL, /* unused when in multimode */ + atoll (fields[4]), /* "Bytes Received" */ + atoll (fields[5])); /* "Bytes Sent" */ } + + read = 1; } return (read); @@ -355,25 +353,25 @@ static int multi3_read (char *name, FILE *fh) } else { - if (strcmp (fields[0], "CLIENT_LIST") == 0) + if (strcmp (fields[0], "CLIENT_LIST") != 0) + continue; + + if (new_naming_schema) + { + iostats_submit (name, /* vpn instance */ + fields[1], /* "Common Name" */ + atoll (fields[4]), /* "Bytes Received" */ + atoll (fields[5])); /* "Bytes Sent" */ + } + else { - if (new_naming_schema) - { - iostats_submit (name, /* vpn instance */ - fields[1], /* "Common Name" */ - atoll (fields[4]), /* "Bytes Received" */ - atoll (fields[5])); /* "Bytes Sent" */ - } - else - { - iostats_submit (fields[1], /* "Common Name" */ - NULL, /* unused when in multimode */ - atoll (fields[4]), /* "Bytes Received" */ - atoll (fields[5])); /* "Bytes Sent" */ - } - - read = 1; + iostats_submit (fields[1], /* "Common Name" */ + NULL, /* unused when in multimode */ + atoll (fields[4]), /* "Bytes Received" */ + atoll (fields[5])); /* "Bytes Sent" */ } + + read = 1; } } -- 2.11.0