diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-06-29 19:32:31 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-06-29 19:32:31 +0400 |
commit | 025f2000d515244e085cd82ac089d7f0271fc531 (patch) | |
tree | 1ce03cdd34717418194aaf5fdee6584ad241cc1c /src/plugins/regexp.c | |
parent | 21a2da8ea3da88fe2e54785189c0a328fcab4a2a (diff) | |
download | rspamd-025f2000d515244e085cd82ac089d7f0271fc531.tar.gz rspamd-025f2000d515244e085cd82ac089d7f0271fc531.zip |
* Add views support (not completely tested yet)
Diffstat (limited to 'src/plugins/regexp.c')
-rw-r--r-- | src/plugins/regexp.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c index 5a1a9cd27..b856aac93 100644 --- a/src/plugins/regexp.c +++ b/src/plugins/regexp.c @@ -36,6 +36,7 @@ #include "../cfg_file.h" #include "../util.h" #include "../expressions.h" +#include "../view.h" #define DEFAULT_STATFILE_PREFIX "./" @@ -591,28 +592,29 @@ process_regexp_item (struct regexp_module_item *item, struct worker_task *task) struct timespec ts1, ts2; uint64_t diff; + if (check_view (task->cfg->views, item->symbol, task)) { #ifdef HAVE_CLOCK_PROCESS_CPUTIME_ID - clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &ts1); + clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &ts1); #elif defined(HAVE_CLOCK_VIRTUAL) - clock_gettime (CLOCK_VIRTUAL, &ts1); + clock_gettime (CLOCK_VIRTUAL, &ts1); #else - clock_gettime (CLOCK_REALTIME, &ts1); + clock_gettime (CLOCK_REALTIME, &ts1); #endif - - if (process_regexp_expression (item->expr, task)) { - insert_result (task, regexp_module_ctx->metric, item->symbol, 1, NULL); - } + if (process_regexp_expression (item->expr, task)) { + insert_result (task, regexp_module_ctx->metric, item->symbol, 1, NULL); + } #ifdef HAVE_CLOCK_PROCESS_CPUTIME_ID - clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &ts2); + clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &ts2); #elif defined(HAVE_CLOCK_VIRTUAL) - clock_gettime (CLOCK_VIRTUAL, &ts2); + clock_gettime (CLOCK_VIRTUAL, &ts2); #else - clock_gettime (CLOCK_REALTIME, &ts2); + clock_gettime (CLOCK_REALTIME, &ts2); #endif - diff = (ts2.tv_sec - ts1.tv_sec) * 1000000 + (ts2.tv_nsec - ts1.tv_nsec) / 1000; - set_counter (item->symbol, diff); + diff = (ts2.tv_sec - ts1.tv_sec) * 1000000 + (ts2.tv_nsec - ts1.tv_nsec) / 1000; + set_counter (item->symbol, diff); + } } static int |