* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: resolver.c,v 1.187 2000/12/20 23:18:37 gson Exp $ */
+/* $Id: resolver.c,v 1.187.2.1 2001/01/05 22:06:19 gson Exp $ */
#include <config.h>
/* Locked by appropriate bucket lock. */
fetchstate state;
isc_boolean_t want_shutdown;
+ isc_boolean_t cloned;
unsigned int references;
isc_event_t control_event;
ISC_LINK(struct fetchctx) link;
fctx->bucketnum = bucketnum;
fctx->state = fetchstate_init;
fctx->want_shutdown = ISC_FALSE;
+ fctx->cloned = ISC_FALSE;
ISC_LIST_INIT(fctx->queries);
ISC_LIST_INIT(fctx->finds);
ISC_LIST_INIT(fctx->forwaddrs);
* Caller must be holding the appropriate lock.
*/
+ fctx->cloned = ISC_TRUE;
hevent = ISC_LIST_HEAD(fctx->events);
if (hevent == NULL)
return;
}
}
- if (fctx == NULL || fctx->state == fetchstate_done) {
+ /*
+ * If we didn't have a fetch, would attach to a done fetch, this
+ * fetch has already cloned its results, or if the fetch has gone
+ * "idle" (no one was interested in it), we need to start a new
+ * fetch instead of joining with the existing one.
+ */
+ if (fctx == NULL ||
+ fctx->state == fetchstate_done ||
+ fctx->cloned ||
+ ISC_LIST_EMPTY(fctx->events)) {
fctx = NULL;
result = fctx_create(res, name, type, domain, nameservers,
options, bucketnum, &fctx);
goto unlock;
new_fctx = ISC_TRUE;
}
+
result = fctx_join(fctx, task, action, arg,
rdataset, sigrdataset, fetch);
if (new_fctx) {