summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-03-14 16:11:10 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-03-14 16:11:10 +0300
commitdc073fd7790591430d2b54c033e838a8894c54b6 (patch)
tree01d7f6f44417047a7ae0a489030ae49b81fa143b
parent9f33f9cd55ba2005277313d84ee2aafec058b6d0 (diff)
downloadrspamd-dc073fd7790591430d2b54c033e838a8894c54b6.tar.gz
rspamd-dc073fd7790591430d2b54c033e838a8894c54b6.zip
Fix another race.
-rw-r--r--src/plugins/surbl.c49
1 files changed, 37 insertions, 12 deletions
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c
index 90ee260fd..b79f21e94 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -798,14 +798,6 @@ free_redirector_session (void *ud)
event_del (&param->ev);
close (param->sock);
- param->task->save.saved--;
- make_surbl_requests (param->url, param->task, param->suffix, FALSE);
- if (param->task->save.saved == 0) {
- /* Call other filters */
- param->task->save.saved = 1;
- process_filters (param->task);
- }
-
}
static void
@@ -833,7 +825,13 @@ redirector_callback (gint fd, short what, void *arg)
msg_err ("write failed %s to %s", strerror (errno), param->redirector->name);
upstream_fail (&param->redirector->up, param->task->tv.tv_sec);
remove_normal_event (param->task->s, free_redirector_session, param);
-
+ param->task->save.saved--;
+ make_surbl_requests (param->url, param->task, param->suffix, FALSE);
+ if (param->task->save.saved == 0) {
+ /* Call other filters */
+ param->task->save.saved = 1;
+ process_filters (param->task);
+ }
return;
}
param->state = STATE_READ;
@@ -843,7 +841,13 @@ redirector_callback (gint fd, short what, void *arg)
param->task->message_id, param->redirector->name);
upstream_fail (&param->redirector->up, param->task->tv.tv_sec);
remove_normal_event (param->task->s, free_redirector_session, param);
-
+ param->task->save.saved--;
+ make_surbl_requests (param->url, param->task, param->suffix, FALSE);
+ if (param->task->save.saved == 0) {
+ /* Call other filters */
+ param->task->save.saved = 1;
+ process_filters (param->task);
+ }
return;
}
break;
@@ -854,7 +858,13 @@ redirector_callback (gint fd, short what, void *arg)
msg_err ("read failed: %s from %s", strerror (errno), param->redirector->name);
upstream_fail (&param->redirector->up, param->task->tv.tv_sec);
remove_normal_event (param->task->s, free_redirector_session, param);
-
+ param->task->save.saved--;
+ make_surbl_requests (param->url, param->task, param->suffix, FALSE);
+ if (param->task->save.saved == 0) {
+ /* Call other filters */
+ param->task->save.saved = 1;
+ process_filters (param->task);
+ }
return;
}
@@ -874,6 +884,13 @@ redirector_callback (gint fd, short what, void *arg)
parse_uri (param->url, memory_pool_strdup (param->task->task_pool, c), param->task->task_pool);
}
}
+ param->task->save.saved--;
+ make_surbl_requests (param->url, param->task, param->suffix, FALSE);
+ if (param->task->save.saved == 0) {
+ /* Call other filters */
+ param->task->save.saved = 1;
+ process_filters (param->task);
+ }
upstream_ok (&param->redirector->up, param->task->tv.tv_sec);
remove_normal_event (param->task->s, free_redirector_session, param);
}
@@ -881,6 +898,13 @@ redirector_callback (gint fd, short what, void *arg)
msg_info ("<%s> reading redirector %s timed out, while waiting for read",
param->redirector->name, param->task->message_id);
upstream_fail (&param->redirector->up, param->task->tv.tv_sec);
+ param->task->save.saved--;
+ make_surbl_requests (param->url, param->task, param->suffix, FALSE);
+ if (param->task->save.saved == 0) {
+ /* Call other filters */
+ param->task->save.saved = 1;
+ process_filters (param->task);
+ }
remove_normal_event (param->task->s, free_redirector_session, param);
}
break;
@@ -936,7 +960,7 @@ static gboolean
surbl_tree_url_callback (gpointer key, gpointer value, void *data)
{
struct redirector_param *param = data;
- struct worker_task *task = param->task;
+ struct worker_task *task;
struct uri *url = value;
f_str_t f;
gchar *red_domain;
@@ -944,6 +968,7 @@ surbl_tree_url_callback (gpointer key, gpointer value, void *data)
GRegex *re;
guint idx, len;
+ task = param->task;
debug_task ("check url %s", struri (url));
if (url->hostlen <= 0) {