* decremented, current_lookup will not be set to NULL.)
*/
static void
-clear_current_lookup() {
+clear_current_lookup(void) {
dig_lookup_t *lookup = current_lookup;
INSIST(!free_now);
debug("clear_current_lookup()");
+ if (lookup == NULL) {
+ debug("current_lookup is already detached");
+ return;
+ }
+
if (ISC_LIST_HEAD(lookup->q) != NULL) {
debug("still have a worker");
return;
isc_result_totext(eresult));
}
+ cancel_lookup(l);
lookup_detach(&l);
query_detach(&query);
return;
region, arg);
LOCK_LOOKUP;
- lookup_attach(query->lookup, &l);
isc_refcount_decrement0(&recvcount);
debug("recvcount=%" PRIuFAST32, isc_refcount_current(&recvcount));
if (eresult == ISC_R_CANCELED) {
debug("recv_done: cancel");
- goto detach_query;
+ isc_nmhandle_detach(&query->readhandle);
+ query_detach(&query);
+ return;
}
+ lookup_attach(query->lookup, &l);
+
if (query->lookup->use_usec) {
TIME_NOW_HIRES(&query->time_recv);
} else {
}
query_detach(&q);
}
- lookup_detach(¤t_lookup);
+
+ /*
+ * current_lookup could have been detached via query_detach().
+ */
+ if (current_lookup != NULL) {
+ lookup_detach(¤t_lookup);
+ }
}
l = ISC_LIST_HEAD(lookup_list);
while (l != NULL) {