2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

use a thread-local variable to get the current running loop

if we had a method to get the running loop, similar to how
isc_tid() gets the current thread ID, we can simplify loop
and loopmgr initialization.

remove most uses of isc_loop_current() in favor of isc_loop().
in some places where that was the only reason to pass loopmgr,
remove loopmgr from the function parameters.
This commit is contained in:
Evan Hunt
2024-03-26 00:13:45 -07:00
committed by Ondřej Surý
parent cad6292fc4
commit c47fa689d4
22 changed files with 77 additions and 79 deletions

View File

@@ -198,8 +198,8 @@ getudpdispatch(int family, dns_dispatchmgr_t *dispatchmgr,
}
static isc_result_t
createview(isc_mem_t *mctx, dns_rdataclass_t rdclass, isc_loopmgr_t *loopmgr,
isc_nm_t *nm, isc_tlsctx_cache_t *tlsctx_client_cache,
createview(isc_mem_t *mctx, dns_rdataclass_t rdclass, isc_nm_t *nm,
isc_tlsctx_cache_t *tlsctx_client_cache,
dns_dispatchmgr_t *dispatchmgr, dns_dispatch_t *dispatchv4,
dns_dispatch_t *dispatchv6, dns_view_t **viewp) {
isc_result_t result;
@@ -214,7 +214,7 @@ createview(isc_mem_t *mctx, dns_rdataclass_t rdclass, isc_loopmgr_t *loopmgr,
/* Initialize view security roots */
dns_view_initsecroots(view);
CHECK(dns_view_createresolver(view, loopmgr, nm, 0, tlsctx_client_cache,
CHECK(dns_view_createresolver(view, nm, 0, tlsctx_client_cache,
dispatchv4, dispatchv6));
CHECK(dns_db_create(mctx, CACHEDB_DEFAULT, dns_rootname,
dns_dbtype_cache, rdclass, 0, NULL,
@@ -290,9 +290,8 @@ dns_client_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr, isc_nm_t *nm,
isc_refcount_init(&client->references, 1);
/* Create the default view for class IN */
result = createview(mctx, dns_rdataclass_in, loopmgr, nm,
tlsctx_client_cache, client->dispatchmgr,
dispatchv4, dispatchv6, &view);
result = createview(mctx, dns_rdataclass_in, nm, tlsctx_client_cache,
client->dispatchmgr, dispatchv4, dispatchv6, &view);
if (result != ISC_R_SUCCESS) {
goto cleanup_references;
}