Make async hooks code use the 'recursions' array

Async hooks are the last feature using the client->fetchhandle and
client->query.fetch pointers.  Update ns_query_hookasync() and
query_hookresume() so that they use a dedicated slot in the 'recursions'
array.  Note that async hooks are still not expected to initiate
recursion if one was already started by a prior ns_query_recurse() call,
so the REQUIRE assertion in ns_query_hookasync() needs to check the
RECTYPE_NORMAL slot rather than the RECTYPE_HOOK one.
This commit is contained in:
Michał Kępień
2022-06-14 13:13:32 +02:00
parent af6fcf5641
commit e0be643f50
3 changed files with 18 additions and 15 deletions

View File

@@ -46,6 +46,7 @@ typedef enum {
RECTYPE_NORMAL,
RECTYPE_PREFETCH,
RECTYPE_RPZ,
RECTYPE_HOOK,
RECTYPE_COUNT,
} ns_query_rectype_t;
@@ -59,6 +60,8 @@ typedef enum {
((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
@@ -70,6 +73,8 @@ typedef enum {
((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