RECTYPE_NORMAL,
RECTYPE_PREFETCH,
RECTYPE_RPZ,
+ RECTYPE_HOOK,
RECTYPE_COUNT,
} ns_query_rectype_t;
((client)->query.recursions[RECTYPE_PREFETCH].handle)
#define HANDLE_RECTYPE_RPZ(client) \
((client)->query.recursions[RECTYPE_RPZ].handle)
+#define HANDLE_RECTYPE_HOOK(client) \
+ ((client)->query.recursions[RECTYPE_HOOK].handle)
/*%
* Helper macros for accessing dns_fetch_t pointers for a specific recursion a
((client)->query.recursions[RECTYPE_PREFETCH].fetch)
#define FETCH_RECTYPE_RPZ(client) \
((client)->query.recursions[RECTYPE_RPZ].fetch)
+#define FETCH_RECTYPE_HOOK(client) \
+ ((client)->query.recursions[RECTYPE_HOOK].fetch)
/*%
* nameserver recursion parameters, to uniquely identify a recursion
UNLOCK(&client->manager->reclock);
/*
- * This event is running under a client task, so it's safe to detach
- * the fetch handle. And it should be done before resuming query
- * processing below, since that may trigger another recursion or
- * asynchronous hook event.
+ * The fetch handle should be detached before resuming query processing
+ * below, since that may trigger another recursion or asynchronous hook
+ * event.
*/
- isc_nmhandle_detach(&client->fetchhandle);
+ isc_nmhandle_detach(&HANDLE_RECTYPE_HOOK(client));
client->state = NS_CLIENTSTATE_WORKING;
REQUIRE(NS_CLIENT_VALID(client));
REQUIRE(client->query.hookactx == NULL);
- REQUIRE(client->query.fetch == NULL);
+ REQUIRE(FETCH_RECTYPE_NORMAL(client) == NULL);
result = check_recursionquota(client);
if (result != ISC_R_SUCCESS) {
* attribute won't be checked anywhere.
*
* Hook-based asynchronous processing cannot coincide with normal
- * recursion, so we can safely use fetchhandle here. Unlike in
- * ns_query_recurse(), we attach to the handle only if 'runasync'
- * succeeds. It should be safe since we're either in the client
- * task or pausing it.
+ * recursion. Unlike in ns_query_recurse(), we attach to the handle
+ * only if 'runasync' succeeds. It should be safe since we're either in
+ * the client task or pausing it.
*/
- isc_nmhandle_attach(client->handle, &client->fetchhandle);
+ isc_nmhandle_attach(client->handle, &HANDLE_RECTYPE_HOOK(client));
return (ISC_R_SUCCESS);
cleanup:
}
} else {
/*
- * Resume from the completion of async event.
- * fetchhandle should have been detached so that we can start
- * another async event or DNS recursive resolution.
+ * Resume from the completion of async event. The fetch handle
+ * should have been detached so that we can start another async
+ * event or DNS recursive resolution.
*/
- INSIST(qctx->client->fetchhandle == NULL);
+ INSIST(HANDLE_RECTYPE_HOOK(qctx->client) == NULL);
asdata->async = false;
switch (hookpoint) {
case NS_QUERY_GOT_ANSWER_BEGIN: