]> granicus.if.org Git - libevent/commitdiff
cancel the probe request when the server is freed, and ignore cancelled probe callbacks
authorGreg Hazel <ghazel@gmail.com>
Thu, 19 Apr 2012 04:29:21 +0000 (21:29 -0700)
committerGreg Hazel <ghazel@gmail.com>
Thu, 19 Apr 2012 04:29:21 +0000 (21:29 -0700)
evdns.c

diff --git a/evdns.c b/evdns.c
index 02f5dff53056cddf88f49da003e57fb780f62a0b..ba010d46f96449738288aa024086fa3d4214c8b1 100644 (file)
--- a/evdns.c
+++ b/evdns.c
@@ -2250,6 +2250,10 @@ nameserver_probe_callback(int result, char type, int count, int ttl, void *addre
        (void) ttl;
        (void) addresses;
 
+       if (result == DNS_ERR_CANCEL) {
+               return;
+       }
+
        EVDNS_LOCK(ns->base);
        ns->probe_request = NULL;
        if (result == DNS_ERR_CANCEL) {
@@ -2361,6 +2365,10 @@ evdns_base_clear_nameservers_and_suspend(struct evdns_base *base)
                (void) event_del(&server->event);
                if (evtimer_initialized(&server->timeout_event))
                        (void) evtimer_del(&server->timeout_event);
+               if (server->probe_request) {
+                       evdns_cancel_request(server->base, server->probe_request);
+                       server->probe_request = NULL;
+               }
                if (server->socket >= 0)
                        evutil_closesocket(server->socket);
                mm_free(server);