From: Florian Forster Date: Mon, 7 Dec 2009 10:50:02 +0000 (+0100) Subject: openvpn plugin: Remove one level of indentation in the read functions. X-Git-Tag: collectd-4.9.0~37^2~1 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=424eab864a9f290d4a7638e0af03831429d48da8;p=collectd.git openvpn plugin: Remove one level of indentation in the read functions. --- 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; } }