Revision
17013
Author
nazim
Date
2010-03-16 13:22:24 -0500 (Tue, 16 Mar 2010)

Log Message

Plugins metric matching error fixed

Modified Paths

Diff

Modified: freeswitch/trunk/contrib/nazim/xmlcdrd/main.c (17012 => 17013)


--- freeswitch/trunk/contrib/nazim/xmlcdrd/main.c	2010-03-16 16:52:01 UTC (rev 17012)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/main.c	2010-03-16 18:22:24 UTC (rev 17013)
@@ -260,13 +260,14 @@
                 //If no metrics defined, run anyway
                 if (0 == plugtab.tags[i].metrics.tag_count)
                 {
+                    fprintf (stderr, "plugin matched\n");
                     plug->plugin_main(&vex, &plug->state);
                     continue;
                 }
 
                 //match metric regexps
                 int j;
-                int run = 0;
+                int run = 1;
                 for (j = 0; j < plugtab.tags[i].metrics.tag_count; j++)
                 {
                     const char *metric_val = 
@@ -288,17 +289,18 @@
                              
                              
 
-                    if (-1 < 
-                        xcdr_plugldr_match_regexp (
+                    if (0 > xcdr_plugldr_match_regexp (
                             plugtab.tags[i].metrics.tags[j].regexp,
                             metric_val, strlen(metric_val)) )
-                        run = 1;
-                    else run = 0;
+                    {
+                        run = 0;
+                        break;
+                    }
                 }
 
                 if (0 < run)
                 {
-                    fprintf (stderr, "metrics matched\n");
+                    fprintf (stderr, "plugin metrics matched\n");
                     plug->plugin_main(&vex, &plug->state);
                 }
             }