aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-08-21 15:47:51 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-08-21 15:47:51 +0100
commita6d3bbb1a744673cf898284f345935467a7179bb (patch)
tree46ef103e41513c918624ce93051d9f228d6f8b7b
parentdfd52fad8db7a38b33a0ff5127bef31c42c3d4b1 (diff)
downloadrspamd-a6d3bbb1a744673cf898284f345935467a7179bb.tar.gz
rspamd-a6d3bbb1a744673cf898284f345935467a7179bb.zip
Allow to skip session in dns resolver.
-rw-r--r--src/libserver/dns.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/libserver/dns.c b/src/libserver/dns.c
index 72903a6cf..dae19e849 100644
--- a/src/libserver/dns.c
+++ b/src/libserver/dns.c
@@ -64,7 +64,9 @@ rspamd_dns_callback (struct rdns_reply *reply, gpointer ud)
* event removing
*/
rdns_request_retain (reply->request);
- remove_normal_event (reqdata->session, rspamd_dns_fin_cb, reqdata->req);
+ if (reqdata->session) {
+ remove_normal_event (reqdata->session, rspamd_dns_fin_cb, reqdata->req);
+ }
}
gboolean
@@ -89,15 +91,17 @@ make_dns_request (struct rspamd_dns_resolver *resolver,
resolver->request_timeout, resolver->max_retransmits, 1, name,
type);
- if (req != NULL) {
- register_async_event (session,
- (event_finalizer_t)rspamd_dns_fin_cb,
- req,
- g_quark_from_static_string ("dns resolver"));
- reqdata->req = req;
- }
- else {
- return FALSE;
+ if (session) {
+ if (req != NULL) {
+ register_async_event (session,
+ (event_finalizer_t)rspamd_dns_fin_cb,
+ req,
+ g_quark_from_static_string ("dns resolver"));
+ reqdata->req = req;
+ }
+ else {
+ return FALSE;
+ }
}
return TRUE;