client = isc_mem_get(clientmgr->mctx, sizeof(*client));
- result = ns__client_setup(client, clientmgr, true);
- if (result != ISC_R_SUCCESS) {
- return;
- }
+ ns__client_setup(client, clientmgr, true);
ns_client_log(client, DNS_LOGCATEGORY_SECURITY,
NS_LOGMODULE_CLIENT, ISC_LOG_DEBUG(3),
"allocate new client");
} else {
- result = ns__client_setup(client, NULL, false);
- if (result != ISC_R_SUCCESS) {
- return;
- }
+ ns__client_setup(client, NULL, false);
}
client->state = NS_CLIENTSTATE_READY;
return (ISC_R_SUCCESS);
}
-isc_result_t
+void
ns__client_setup(ns_client_t *client, ns_clientmgr_t *mgr, bool new) {
- isc_result_t result;
-
/*
* Note: creating a client does not add the client to the
* manager's client list, the caller is responsible for that.
* and the functions it calls will require it.
*/
client->magic = NS_CLIENT_MAGIC;
- result = ns_query_init(client);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ ns_query_init(client);
} else {
REQUIRE(NS_CLIENT_VALID(client));
REQUIRE(client->manager->tid == isc_tid());
client->magic = NS_CLIENT_MAGIC;
CTRACE("client_setup");
-
- return (ISC_R_SUCCESS);
-
-cleanup:
- dns_message_detach(&client->message);
- ns_clientmgr_detach(&client->manager);
-
- return (result);
}
/***
ISC_REFCOUNT_DECL(ns_clientmgr);
-isc_result_t
+void
ns__client_setup(ns_client_t *client, ns_clientmgr_t *manager, bool new);
/*%<
* Perform initial setup of an allocated client.
* other aspects of hook-triggered asynchronous event handling.
*/
-isc_result_t
+void
ns_query_init(ns_client_t *client);
void
query_reset(client, true);
}
-isc_result_t
+void
ns_query_init(ns_client_t *client) {
- isc_result_t result = ISC_R_SUCCESS;
-
REQUIRE(NS_CLIENT_VALID(client));
client->query = (ns_query_t){ 0 };
query_reset(client, false);
ns_client_newdbversion(client, 3);
ns_client_newnamebuf(client);
-
- return (result);
}
/*%
ns_test_getdata(const char *file, unsigned char *buf, size_t bufsiz,
size_t *sizep);
-isc_result_t
+void
ns_test_getclient(ns_interface_t *ifp0, bool tcp, ns_client_t **clientp);
/*%
dns_zone_detach(&served_zone);
}
-isc_result_t
+void
ns_test_getclient(ns_interface_t *ifp0, bool tcp, ns_client_t **clientp) {
- isc_result_t result;
ns_client_t *client;
ns_clientmgr_t *clientmgr;
int i;
clientmgr = ns_interfacemgr_getclientmgr(interfacemgr);
client = isc_mem_get(clientmgr->mctx, sizeof(*client));
- result = ns__client_setup(client, clientmgr, true);
+ ns__client_setup(client, clientmgr, true);
for (i = 0; i < 32; i++) {
if (atomic_load(&client_addrs[i]) == (uintptr_t)NULL ||
atomic_store(&client_addrs[i], (uintptr_t)client);
client->handle = (isc_nmhandle_t *)client; /* Hack */
*clientp = client;
-
- return (result);
}
/*%
/*
* Allocate and initialize a client structure.
*/
- result = ns_test_getclient(NULL, false, &client);
- if (result != ISC_R_SUCCESS) {
- return (result);
- }
+ ns_test_getclient(NULL, false, &client);
client->tnow = isc_time_now();
/*
isc_buffer_t nbuf;
size_t nsize;
- result = ns_test_getclient(NULL, false, &client);
- assert_int_equal(result, ISC_R_SUCCESS);
+ ns_test_getclient(NULL, false, &client);
result = dns_test_makeview("view", false, false, &client->view);
assert_int_equal(result, ISC_R_SUCCESS);