Skip to content

Instantly share code, notes, and snippets.

@yasuoka
Created March 20, 2014 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yasuoka/6529e91a54e0146e962f to your computer and use it in GitHub Desktop.
Save yasuoka/6529e91a54e0146e962f to your computer and use it in GitHub Desktop.
diff --git a/evdns.c b/evdns.c
index 59c3abe..c8c2936 100644
--- a/evdns.c
+++ b/evdns.c
@@ -3995,13 +3995,6 @@ evdns_base_free_and_unlock(struct evdns_base *base, int fail_requests)
request_finished(base->req_heads[i], &REQ_HEAD(base, base->req_heads[i]->trans_id), 1);
}
}
- while (base->req_waiting_head) {
- if (fail_requests)
- reply_schedule_callback(base->req_waiting_head, 0, DNS_ERR_SHUTDOWN, NULL);
- request_finished(base->req_waiting_head, &base->req_waiting_head, 1);
- }
- base->global_requests_inflight = base->global_requests_waiting = 0;
-
for (server = base->server_head; server; server = server_next) {
server_next = server->next;
evdns_nameserver_free(server);
@@ -4010,6 +4003,13 @@ evdns_base_free_and_unlock(struct evdns_base *base, int fail_requests)
}
base->server_head = NULL;
base->global_good_nameservers = 0;
+ while (base->req_waiting_head) {
+ if (fail_requests)
+ reply_schedule_callback(base->req_waiting_head, 0, DNS_ERR_SHUTDOWN, NULL);
+ request_finished(base->req_waiting_head, &base->req_waiting_head, 1);
+ }
+ base->global_requests_inflight = base->global_requests_waiting = 0;
+
if (base->global_search_state) {
for (dom = base->global_search_state->head; dom; dom = dom_next) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment