diff --git a/lib/ns/client.c b/lib/ns/client.c index 7351c91923..6e381d03b4 100644 --- a/lib/ns/client.c +++ b/lib/ns/client.c @@ -1838,19 +1838,13 @@ ns_client_request(isc_nmhandle_t *handle, isc_result_t eresult, 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; @@ -2520,10 +2514,8 @@ ns__client_tcpconn(isc_nmhandle_t *handle, isc_result_t result, void *arg) { 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. @@ -2548,10 +2540,7 @@ ns__client_setup(ns_client_t *client, ns_clientmgr_t *mgr, bool new) { * 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()); @@ -2583,14 +2572,6 @@ ns__client_setup(ns_client_t *client, ns_clientmgr_t *mgr, bool new) { 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); } /*** diff --git a/lib/ns/include/ns/client.h b/lib/ns/include/ns/client.h index 1213c6ec3b..89ee79a67c 100644 --- a/lib/ns/include/ns/client.h +++ b/lib/ns/include/ns/client.h @@ -543,7 +543,7 @@ ns_client_findversion(ns_client_t *client, dns_db_t *db); 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. diff --git a/lib/ns/include/ns/query.h b/lib/ns/include/ns/query.h index f6d0712c93..4f2c185b85 100644 --- a/lib/ns/include/ns/query.h +++ b/lib/ns/include/ns/query.h @@ -287,7 +287,7 @@ ns_query_hookasync(query_ctx_t *qctx, ns_query_starthookasync_t runasync, * other aspects of hook-triggered asynchronous event handling. */ -isc_result_t +void ns_query_init(ns_client_t *client); void diff --git a/lib/ns/query.c b/lib/ns/query.c index 203ab46257..1a0e74918c 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -806,10 +806,8 @@ ns_query_free(ns_client_t *client) { 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 }; @@ -827,8 +825,6 @@ ns_query_init(ns_client_t *client) { query_reset(client, false); ns_client_newdbversion(client, 3); ns_client_newnamebuf(client); - - return (result); } /*% diff --git a/tests/include/tests/ns.h b/tests/include/tests/ns.h index c313abfa04..831ae80399 100644 --- a/tests/include/tests/ns.h +++ b/tests/include/tests/ns.h @@ -88,7 +88,7 @@ isc_result_t 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); /*% diff --git a/tests/libtest/ns.c b/tests/libtest/ns.c index 980ab6b904..b6ee7490e4 100644 --- a/tests/libtest/ns.c +++ b/tests/libtest/ns.c @@ -216,9 +216,8 @@ ns_test_cleanup_zone(void) { 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; @@ -229,7 +228,7 @@ ns_test_getclient(ns_interface_t *ifp0, bool tcp, ns_client_t **clientp) { 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 || @@ -244,8 +243,6 @@ ns_test_getclient(ns_interface_t *ifp0, bool tcp, ns_client_t **clientp) { atomic_store(&client_addrs[i], (uintptr_t)client); client->handle = (isc_nmhandle_t *)client; /* Hack */ *clientp = client; - - return (result); } /*% @@ -438,10 +435,7 @@ ns_test_qctx_create(const ns_test_qctx_create_params_t *params, /* * 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(); /* diff --git a/tests/ns/notify_test.c b/tests/ns/notify_test.c index bb2389f2e5..806470a624 100644 --- a/tests/ns/notify_test.c +++ b/tests/ns/notify_test.c @@ -67,8 +67,7 @@ ISC_LOOP_TEST_IMPL(notify_start) { 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);