aboutsummaryrefslogtreecommitdiffstats
path: root/perl.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2008-08-21 17:58:30 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2008-08-21 17:58:30 +0400
commitf3b6712e04fd993caccaa18e425639d85d81b1eb (patch)
treeaaa504a733d1c442692a8e25ad5680657de71942 /perl.c
parente90352d20a0d5f615c906b7719f95599cb2aaeac (diff)
downloadrspamd-f3b6712e04fd993caccaa18e425639d85d81b1eb.tar.gz
rspamd-f3b6712e04fd993caccaa18e425639d85d81b1eb.zip
* Add filters logic
* Perl should use separate memcached context for its operations (just do memcpy with the same socket) TODO: add block mechanics here to avoid memcached connection closing before perl operation is finished * Change logic of perl chain filter
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/perl.c b/perl.c
index e2ae086eb..2cdfacf55 100644
--- a/perl.c
+++ b/perl.c
@@ -125,16 +125,23 @@ perl_call_url_filter (const char *function, struct worker_task *task)
}
int
-perl_call_chain_filter (const char *function, struct worker_task *task)
+perl_call_chain_filter (const char *function, struct worker_task *task, int *marks, unsigned int number)
{
- int result;
+ int result, i;
+ AV *av;
dSP;
-
+
ENTER;
SAVETMPS;
+ av = newAV();
+ av_extend (av, number);
+ for (i = 0; i < number; i ++) {
+ av_push (av, sv_2mortal (newSViv (marks[i])));
+ }
PUSHMARK (SP);
XPUSHs (sv_2mortal (newSViv (PTR2IV (task))));
+ XPUSHs (AvARRAY (av));
PUTBACK;
call_pv (function, G_SCALAR);
@@ -146,6 +153,7 @@ perl_call_chain_filter (const char *function, struct worker_task *task)
PUTBACK;
FREETMPS;
+ av_undef (av);
LEAVE;
@@ -170,6 +178,9 @@ void perl_call_memcached_callback (memcached_ctx_t *ctx, memc_error_t error, voi
PUTBACK;
call_sv (callback_data->callback, G_SCALAR);
+
+ free (callback_data);
+ free (ctx);
SPAGAIN;
FREETMPS;