summaryrefslogtreecommitdiffstats
path: root/src/dns.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-13 19:43:30 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-13 19:43:30 +0400
commit45fb6482ddda8ddd782e11cb2bad45ec9454977a (patch)
tree58f826180f0c67b6762628ee6432871237b97c52 /src/dns.c
parentbe1e62231409bf708502561a7c10e4896b620514 (diff)
downloadrspamd-45fb6482ddda8ddd782e11cb2bad45ec9454977a.tar.gz
rspamd-45fb6482ddda8ddd782e11cb2bad45ec9454977a.zip
* Calling callbacks may cause destroying session from which we are calling callback so we MUST call callback as the latest action
Diffstat (limited to 'src/dns.c')
-rw-r--r--src/dns.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/dns.c b/src/dns.c
index 0bc23925e..a0b9b36aa 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -957,9 +957,9 @@ dns_timer_cb (int fd, short what, void *arg)
rep = memory_pool_alloc0 (req->pool, sizeof (struct rspamd_dns_reply));
rep->request = req;
rep->code = DNS_RC_SERVFAIL;
- req->func (rep, req->arg);
upstream_fail (&rep->request->server->up, rep->request->time);
remove_normal_event (req->session, dns_fin_cb, req);
+ req->func (rep, req->arg);
return;
}
/* Select other server */
@@ -970,8 +970,8 @@ dns_timer_cb (int fd, short what, void *arg)
rep = memory_pool_alloc0 (req->pool, sizeof (struct rspamd_dns_reply));
rep->request = req;
rep->code = DNS_RC_SERVFAIL;
- req->func (rep, req->arg);
remove_normal_event (req->session, dns_fin_cb, req);
+ req->func (rep, req->arg);
return;
}
@@ -984,9 +984,10 @@ dns_timer_cb (int fd, short what, void *arg)
rep = memory_pool_alloc0 (req->pool, sizeof (struct rspamd_dns_reply));
rep->request = req;
rep->code = DNS_RC_SERVFAIL;
- req->func (rep, req->arg);
upstream_fail (&rep->request->server->up, rep->request->time);
remove_normal_event (req->session, dns_fin_cb, req);
+ req->func (rep, req->arg);
+
return;
}
/* Add other retransmit event */
@@ -998,9 +999,10 @@ dns_timer_cb (int fd, short what, void *arg)
rep = memory_pool_alloc0 (req->pool, sizeof (struct rspamd_dns_reply));
rep->request = req;
rep->code = DNS_RC_SERVFAIL;
- req->func (rep, req->arg);
remove_normal_event (req->session, dns_fin_cb, req);
upstream_fail (&rep->request->server->up, rep->request->time);
+ req->func (rep, req->arg);
+
}
}
@@ -1020,8 +1022,9 @@ dns_retransmit_handler (int fd, short what, void *arg)
rep = memory_pool_alloc0 (req->pool, sizeof (struct rspamd_dns_reply));
rep->request = req;
rep->code = DNS_RC_SERVFAIL;
- req->func (rep, req->arg);
upstream_fail (&rep->request->server->up, rep->request->time);
+ req->func (rep, req->arg);
+
return;
}
r = send_dns_request (req);
@@ -1030,8 +1033,9 @@ dns_retransmit_handler (int fd, short what, void *arg)
rep = memory_pool_alloc0 (req->pool, sizeof (struct rspamd_dns_reply));
rep->request = req;
rep->code = DNS_RC_SERVFAIL;
- req->func (rep, req->arg);
upstream_fail (&rep->request->server->up, rep->request->time);
+ req->func (rep, req->arg);
+
}
else if (r == 1) {
/* Add timer event */