pullup:
It was possible to join to an already running fctx after it had "cloned" its events, but before it sent them. In this case, the event of the newly joined fetch would not contain the answer, and would trigger the INSIST() in fctx_sendevents(). [RT #597, #605, #607]
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* 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>
|
||||
|
||||
@@ -152,6 +152,7 @@ struct fetchctx {
|
||||
/* 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;
|
||||
@@ -2048,6 +2049,7 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type,
|
||||
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);
|
||||
@@ -2302,6 +2304,7 @@ clone_results(fetchctx_t *fctx) {
|
||||
* Caller must be holding the appropriate lock.
|
||||
*/
|
||||
|
||||
fctx->cloned = ISC_TRUE;
|
||||
hevent = ISC_LIST_HEAD(fctx->events);
|
||||
if (hevent == NULL)
|
||||
return;
|
||||
@@ -4867,7 +4870,16 @@ dns_resolver_createfetch(dns_resolver_t *res, dns_name_t *name,
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -4875,6 +4887,7 @@ dns_resolver_createfetch(dns_resolver_t *res, dns_name_t *name,
|
||||
goto unlock;
|
||||
new_fctx = ISC_TRUE;
|
||||
}
|
||||
|
||||
result = fctx_join(fctx, task, action, arg,
|
||||
rdataset, sigrdataset, fetch);
|
||||
if (new_fctx) {
|
||||
|
||||
Reference in New Issue
Block a user