Refactored dns_message_t for using attach/detach semantics

This commit will be used as a base for the next code updates in
order to have a better control of dns_message_t objects' lifetime.

(cherry picked from commit 12d6d13100)
This commit is contained in:
Diego Fronza
2020-09-21 16:16:15 -03:00
committed by Mark Andrews
parent d1bcb2fdbe
commit da84f8d1fd
25 changed files with 140 additions and 113 deletions

View File

@@ -79,7 +79,7 @@ check_response(isc_buffer_t *buf) {
assert_int_equal(message->rcode, dns_rcode_noerror);
dns_message_destroy(&message);
dns_message_detach(&message);
}
/* test ns_notify_start() */
@@ -126,7 +126,7 @@ notify_start(void **state) {
* handler.
*/
if (client->message != NULL) {
dns_message_destroy(&client->message);
dns_message_detach(&client->message);
}
client->message = nmsg;
nmsg = NULL;

View File

@@ -664,7 +664,7 @@ attach_query_msg_to_client(ns_client_t *client, const char *qnamestr,
* Destroy the created message as it was rendered into "querybuf" and
* the latter is all we are going to need from now on.
*/
dns_message_destroy(&message);
dns_message_detach(&message);
/*
* Parse the rendered query, storing results in client->message.
@@ -677,7 +677,7 @@ put_name:
put_rdataset:
dns_message_puttemprdataset(message, &qrdataset);
destroy_message:
dns_message_destroy(&message);
dns_message_detach(&message);
return (result);
}
@@ -813,7 +813,7 @@ ns_test_qctx_create(const ns_test_qctx_create_params_t *params,
*/
result = create_qctx_for_client(client, qctxp);
if (result != ISC_R_SUCCESS) {
goto destroy_query;
goto detach_query;
}
/*
@@ -824,8 +824,8 @@ ns_test_qctx_create(const ns_test_qctx_create_params_t *params,
return (ISC_R_SUCCESS);
destroy_query:
dns_message_destroy(&client->message);
detach_query:
dns_message_detach(&client->message);
detach_view:
dns_view_detach(&client->view);
detach_client: