* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dighost.c,v 1.221.2.19.2.34 2006/08/01 00:54:20 marka Exp $ */
+/* $Id: dighost.c,v 1.221.2.19.2.35 2006/10/02 03:14:24 marka Exp $ */
/*
* Notice to programmers: Do not use this code as an example of how to
fatal("memory allocation failure in %s:%d",
__FILE__, __LINE__);
looknew->pending = ISC_TRUE;
+ looknew->waiting_senddone = ISC_FALSE;
+ looknew->pending_clear = ISC_FALSE;
looknew->textname[0] = 0;
looknew->cmdline[0] = 0;
looknew->rdtype = dns_rdatatype_a;
if (lwresult != LWRES_R_SUCCESS)
fatal("lwres_context_create failed");
- if (isc_file_exists(RESOLV_CONF))
- lwresult = lwres_conf_parse(lwctx, RESOLV_CONF);
- if (lwresult != LWRES_R_SUCCESS)
+ lwresult = lwres_conf_parse(lwctx, RESOLV_CONF);
+ if (lwresult != LWRES_R_SUCCESS && lwresult != LWRES_R_NOTFOUND)
fatal("parse of %s failed", RESOLV_CONF);
lwconf = lwres_conf_get(lwctx);
isc_mempool_put(commctx, query->recvspace);
isc_buffer_invalidate(&query->recvbuf);
isc_buffer_invalidate(&query->lengthbuf);
- isc_mem_free(mctx, query);
+ if (lookup->waiting_senddone)
+ query->pending_free = ISC_TRUE;
+ else
+ isc_mem_free(mctx, query);
}
/*
debug("query to %s still pending", q->servname);
q = ISC_LIST_NEXT(q, link);
}
- return (ISC_FALSE);
}
+ return (ISC_FALSE);
+ }
+
+ if (lookup->waiting_senddone) {
+ lookup->pending_clear = ISC_TRUE;
+ return (ISC_TRUE);
}
+
/*
* At this point, we know there are no queries on the lookup,
* so can make it go away also.
return (ISC_TRUE);
}
-
/*
* If we can, start the next lookup in the queue running.
* This assumes that the lookup on the head of the queue hasn't been
query, lookup);
query->lookup = lookup;
query->waiting_connect = ISC_FALSE;
+ query->pending_free = ISC_FALSE;
query->recv_made = ISC_FALSE;
query->first_pass = ISC_TRUE;
query->first_soa_rcvd = ISC_FALSE;
query = event->ev_arg;
l = query->lookup;
+ l->waiting_senddone = ISC_FALSE;
if (l->ns_search_only && !l->trace_root) {
debug("sending next, since searching");
isc_event_free(&event);
+ if (query->pending_free)
+ isc_mem_free(mctx, query);
+ if (l->pending_clear)
+ try_clear_lookup(l);
+
check_if_done();
UNLOCK_LOOKUP;
}
debug("sending a request");
TIME_NOW(&query->time_sent);
INSIST(query->sock != NULL);
+ l->waiting_senddone = ISC_TRUE;
result = isc_socket_sendtov(query->sock, &query->sendlist,
global_task, send_done, query,
&query->sockaddr, NULL);
if (!query->first_soa_rcvd) {
debug("sending a request in launch_next_query");
TIME_NOW(&query->time_sent);
+ query->lookup->waiting_senddone = ISC_TRUE;
result = isc_socket_sendv(query->sock, &query->sendlist,
global_task, send_done, query);
check_result(result, "isc_socket_sendv");