return (*viewmatchresult);
}
+ /* Also no offloading when there is no view at all to match against. */
+ view = get_matching_view_next(NULL, message->rdclass);
+ if (view == NULL) {
+ *viewmatchresult = ISC_R_NOTFOUND;
+ return (*viewmatchresult);
+ }
+
+ dns_message_resetsig(message);
+
matching_view_ctx_t *mvctx = isc_mem_get(message->mctx, sizeof(*mvctx));
*mvctx = (matching_view_ctx_t){
.srcaddr = srcaddr,
isc_loop_attach(loop, &mvctx->loop);
dns_message_attach(message, &mvctx->message);
- dns_message_resetsig(message);
-
- view = get_matching_view_next(NULL, message->rdclass);
- if (view == NULL) {
- *mvctx->viewmatchresult = ISC_R_NOTFOUND;
- isc_async_run(loop, get_matching_view_done, mvctx);
- return (DNS_R_WAIT);
- }
-
/*
* If the message has a SIG0 signature which we are going to
* check, and the client is not exempt from the SIG(0) quota,
return (result);
}
+static void
+ns_client_async_reset(ns_client_t *client) {
+ if (client->async) {
+ client->async = false;
+ if (client->handle != NULL) {
+ isc_nmhandle_unref(client->handle);
+ }
+ }
+}
+
void
ns__client_reset_cb(void *client0) {
ns_client_t *client = client0;
client->keytag_len = 0;
}
- if (client->async) {
- client->async = false;
- if (client->handle != NULL) {
- isc_nmhandle_unref(client->handle);
- }
- }
+ ns_client_async_reset(client);
client->state = NS_CLIENTSTATE_READY;
dns_message_puttemprdataset(client->message, &client->opt);
}
- if (client->async) {
- client->async = false;
- if (client->handle != NULL) {
- isc_nmhandle_unref(client->handle);
- }
- }
+ ns_client_async_reset(client);
dns_message_detach(&client->message);
ns_client_request_continue, client, &client->sigresult,
&client->viewmatchresult, &client->view);
+ /* Async mode. */
if (result == DNS_R_WAIT) {
INSIST(client->async == true);
return (DNS_R_WAIT);
}
/*
- * matchingview() is allowed to return anything other than DNS_R_WAIT
- * only in non-async mode, in which case 'result' must be equal to
+ * matchingview() returning anything other than DNS_R_WAIT means it's
+ * not running in async mode, in which case 'result' must be equal to
* 'client->viewmatchresult'.
*/
- INSIST(client->async == false);
INSIST(result == client->viewmatchresult);
+ /* Non-async mode. */
+ ns_client_async_reset(client);
+
return (result);
}
}
cleanup:
-
- /*
- * If we are running async then 'unref' the handle and reset the async
- * flag, so that the destructor doesn't try to 'unref' the handle too.
- */
- if (client->async) {
- client->async = false;
- if (client->handle != NULL) {
- isc_nmhandle_unref(client->handle);
- }
- }
+ ns_client_async_reset(client);
}
isc_result_t