aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-09-22 09:24:28 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-09-22 09:27:45 +0100
commit93afc2d45f6dde78372a29537bf2fbfd10ceb532 (patch)
tree3ece830cba75c2df325d4449ff552563b065034f /contrib
parentf880b3e10995c19029a61ac61f63497b96913316 (diff)
downloadrspamd-93afc2d45f6dde78372a29537bf2fbfd10ceb532.tar.gz
rspamd-93afc2d45f6dde78372a29537bf2fbfd10ceb532.zip
[Fix] Another fix for rdns write errors
Issue: #971
Diffstat (limited to 'contrib')
-rw-r--r--contrib/librdns/resolver.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/contrib/librdns/resolver.c b/contrib/librdns/resolver.c
index 664d42026..329caa620 100644
--- a/contrib/librdns/resolver.c
+++ b/contrib/librdns/resolver.c
@@ -347,6 +347,8 @@ rdns_process_timer (void *arg)
req->state = RDNS_REQUEST_REPLIED;
req->func (rep, req->arg);
REF_RELEASE (req);
+
+ return;
}
/* Select random IO channel */
@@ -356,13 +358,20 @@ rdns_process_timer (void *arg)
renew = true;
}
+ /*
+ * Note: when `renew` is true, then send_request deals with the
+ * timers and events itself
+ */
r = rdns_send_request (req, req->io->sock, renew);
if (r == 0) {
/* Retransmit one more time */
- req->async->del_timer (req->async->data,
+ if (!renew) {
+ req->async->del_timer (req->async->data,
req->async_event);
- req->async_event = req->async->add_write (req->async->data,
- req->io->sock, req);
+ req->async_event = req->async->add_write (req->async->data,
+ req->io->sock, req);
+ }
+
req->state = RDNS_REQUEST_WAIT_SEND;
}
else if (r == -1) {
@@ -374,6 +383,11 @@ rdns_process_timer (void *arg)
UPSTREAM_FAIL (req->io->srv, time (NULL));
}
+ if (!renew) {
+ req->async->del_timer (req->async->data,
+ req->async_event);
+ }
+
/* We have not scheduled timeout actually due to send error */
rep = rdns_make_reply (req, RDNS_RC_NETERR);
req->state = RDNS_REQUEST_REPLIED;