#include "utils_llist.h"
#include "utils_heap.h"
#include "utils_cache.h"
-#include "utils_threshold.h"
#include "filter_chain.h"
/*
}
}
- le = llentry_create (rf->rf_name, rf);
+ le = llist_search (read_list, rf->rf_name);
if (le == NULL)
{
- pthread_mutex_unlock (&read_lock);
- ERROR ("plugin_insert_read: llentry_create failed.");
- return (-1);
- }
+ le = llentry_create (rf->rf_name, rf);
+ if (le == NULL)
+ {
+ pthread_mutex_unlock (&read_lock);
+ ERROR ("plugin_insert_read: llentry_create failed.");
+ return (-1);
+ }
- status = c_heap_insert (read_heap, rf);
- if (status != 0)
+ status = c_heap_insert (read_heap, rf);
+ if (status != 0)
+ {
+ pthread_mutex_unlock (&read_lock);
+ ERROR ("plugin_insert_read: c_heap_insert failed.");
+ llentry_destroy (le);
+ return (-1);
+ }
+
+ /* This does not fail. */
+ llist_append (read_list, le);
+ }
+ else
{
- pthread_mutex_unlock (&read_lock);
- ERROR ("plugin_insert_read: c_heap_insert failed.");
- llentry_destroy (le);
- return (-1);
+ INFO ("plugin: plugin_insert_read: "
+ "read function for plugin `%s' already added.",
+ rf->rf_name);
}
- /* This does not fail. */
- llist_append (read_list, le);
-
pthread_mutex_unlock (&read_lock);
return (0);
} /* int plugin_insert_read */
cf = le->value;
callback = cf->cf_callback;
- status = (*callback) (vl);
+ status = (*callback) (vl, &cf->cf_udata);
if (status != 0)
{
if (status < 0)
/* Update the value cache */
uc_update (ds, vl);
- /* Initiate threshold checking */
- ut_check_threshold (ds, vl);
-
if (post_cache_chain != NULL)
{
status = fc_process_chain (ds, vl, post_cache_chain);