]> source.dussan.org Git - rspamd.git/commitdiff
Fix for libevent. 0.4.0
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 22 Jul 2011 11:58:47 +0000 (15:58 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 22 Jul 2011 11:58:47 +0000 (15:58 +0400)
src/dns.c

index e82b1a9b723de88a604f9d5a560085d6b591fe82..5148e742b7d75eed4a881f00c0840bfc730b27a7 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -539,6 +539,7 @@ send_dns_request (struct rspamd_dns_request *req)
        r = send (req->sock, req->packet, req->pos, 0);
        if (r == -1) {
                if (errno == EAGAIN) {
+                       event_del (&req->io_event);
                        event_set (&req->io_event, req->sock, EV_WRITE, dns_retransmit_handler, req);
                        event_add (&req->io_event, &req->tv);
                        register_async_event (req->session, (event_finalizer_t)event_del, &req->io_event, FALSE);
@@ -551,6 +552,7 @@ send_dns_request (struct rspamd_dns_request *req)
                }
        }
        else if (r < req->pos) {
+               event_del (&req->io_event);
                event_set (&req->io_event, req->sock, EV_WRITE, dns_retransmit_handler, req);
                event_add (&req->io_event, &req->tv);
                register_async_event (req->session, (event_finalizer_t)event_del, &req->io_event, FALSE);
@@ -981,6 +983,7 @@ dns_throttling_cb (gint fd, short what, void *arg)
        resolver->throttling = FALSE;
        resolver->errors = 0;
        msg_info ("stop DNS throttling after %d seconds", (int)resolver->throttling_time.tv_sec);
+       event_del (&resolver->throttling_event);
 }
 
 static void
@@ -1130,6 +1133,7 @@ dns_retransmit_handler (gint fd, short what, void *arg)
                }
                else if (r == 1) {
                        /* Add timer event */
+                       event_del (&req->timer_event);
                        evtimer_set (&req->timer_event, dns_timer_cb, req);
                        evtimer_add (&req->timer_event, &req->tv);