Code

openvpn plugin: Remove one level of indentation in the read functions.
authorFlorian Forster <octo@huhu.verplant.org>
Mon, 7 Dec 2009 10:50:02 +0000 (11:50 +0100)
committerFlorian Forster <sifnfors@informatik.stud.uni-erlangen.de>
Mon, 7 Dec 2009 10:50:02 +0000 (11:50 +0100)
src/openvpn.c

index c71071c09ab7096aa4061d22957b87589cfbb57b..2d460d96a1a925943ee1af19737c71ea0ce0e031 100644 (file)
@@ -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;
                }
        }