From 4be19dcd14cea678511f1d1b269ab89273e987ee Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 20 Apr 2000 13:45:36 +0000 Subject: [PATCH] Send shutdown events when irefs -> 0 and exiting. --- lib/dns/request.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/dns/request.c b/lib/dns/request.c index ceb030ddef..918eb6203f 100644 --- a/lib/dns/request.c +++ b/lib/dns/request.c @@ -242,8 +242,10 @@ mgr_shutdown(dns_requestmgr_t *requestmgr) { request = ISC_LIST_NEXT(request, link)) { dns_request_cancel(request); } - if (ISC_LIST_EMPTY(requestmgr->requests)) + if (requestmgr->iref == 0) { + INSIST(ISC_LIST_EMPTY(requestmgr->requests)); send_shutdown_events(requestmgr); + } } } @@ -278,11 +280,11 @@ requestmgr_detach(dns_requestmgr_t **requestmgrp) { LOCK(&requestmgr->lock); INSIST(requestmgr->iref > 0); requestmgr->iref--; - if (requestmgr->eref == 0 && requestmgr->iref == 0) { - INSIST(requestmgr->exiting && - ISC_LIST_HEAD(requestmgr->requests) == NULL); + if (requestmgr->iref == 0 && requestmgr->exiting) { + INSIST(ISC_LIST_HEAD(requestmgr->requests) == NULL); send_shutdown_events(requestmgr); - need_destroy = ISC_TRUE; + if (requestmgr->eref == 0) + need_destroy = ISC_TRUE; } UNLOCK(&requestmgr->lock); @@ -801,6 +803,7 @@ req_timeout(isc_task_t *task, isc_event_t *event) { dns_request_t *request = event->ev_arg; TRACE(("req_timeout\n")); + UNUSED(task); LOCK(&request->requestmgr->locks[request->hash]); req_cancel(request);