mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 10:10:06 +00:00
Add new isc_managers API to simplify <*>mgr create/destroy
Previously, netmgr, taskmgr, timermgr and socketmgr all had their own isc_<*>mgr_create() and isc_<*>mgr_destroy() functions. The new isc_managers_create() and isc_managers_destroy() fold all four into a single function and makes sure the objects are created and destroy in correct order. Especially now, when taskmgr runs on top of netmgr, the correct order is important and when the code was duplicated at many places it's easy to make mistake. The former isc_<*>mgr_create() and isc_<*>mgr_destroy() functions were made private and a single call to isc_managers_create() and isc_managers_destroy() is required at the program startup / shutdown.
This commit is contained in:
parent
f23afce683
commit
a011d42211
@ -34,6 +34,7 @@
|
||||
#include <isc/hex.h>
|
||||
#include <isc/lib.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/md.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/netmgr.h>
|
||||
@ -1761,10 +1762,8 @@ main(int argc, char *argv[]) {
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
CHECK(isc_appctx_create(mctx, &actx));
|
||||
netmgr = isc_nm_start(mctx, 1);
|
||||
CHECK(isc_taskmgr_create(mctx, 0, netmgr, &taskmgr));
|
||||
CHECK(isc_socketmgr_create(mctx, &socketmgr));
|
||||
CHECK(isc_timermgr_create(mctx, &timermgr));
|
||||
isc_managers_create(mctx, 1, 0, 0, &netmgr, &taskmgr, &timermgr,
|
||||
&socketmgr);
|
||||
|
||||
parse_args(argc, argv);
|
||||
|
||||
@ -1867,18 +1866,7 @@ cleanup:
|
||||
if (client != NULL) {
|
||||
dns_client_destroy(&client);
|
||||
}
|
||||
if (taskmgr != NULL) {
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
}
|
||||
if (netmgr != NULL) {
|
||||
isc_nm_destroy(&netmgr);
|
||||
}
|
||||
if (timermgr != NULL) {
|
||||
isc_timermgr_destroy(&timermgr);
|
||||
}
|
||||
if (socketmgr != NULL) {
|
||||
isc_socketmgr_destroy(&socketmgr);
|
||||
}
|
||||
isc_managers_destroy(&netmgr, &taskmgr, &timermgr, &socketmgr);
|
||||
if (actx != NULL) {
|
||||
isc_appctx_destroy(&actx);
|
||||
}
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <isc/hex.h>
|
||||
#include <isc/lang.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/netdb.h>
|
||||
#include <isc/nonce.h>
|
||||
@ -106,9 +107,9 @@ unsigned int timeout = 0;
|
||||
unsigned int extrabytes;
|
||||
isc_mem_t *mctx = NULL;
|
||||
isc_log_t *lctx = NULL;
|
||||
isc_nm_t *netmgr = NULL;
|
||||
isc_taskmgr_t *taskmgr = NULL;
|
||||
isc_task_t *global_task = NULL;
|
||||
isc_nm_t *netmgr = NULL;
|
||||
isc_sockaddr_t localaddr;
|
||||
isc_refcount_t sendcount = ATOMIC_VAR_INIT(0);
|
||||
isc_refcount_t recvcount = ATOMIC_VAR_INIT(0);
|
||||
@ -1360,10 +1361,7 @@ setup_libs(void) {
|
||||
|
||||
isc_log_setdebuglevel(lctx, 0);
|
||||
|
||||
netmgr = isc_nm_start(mctx, 1);
|
||||
|
||||
result = isc_taskmgr_create(mctx, 0, netmgr, &taskmgr);
|
||||
check_result(result, "isc_taskmgr_create");
|
||||
isc_managers_create(mctx, 1, 0, 0, &netmgr, &taskmgr, NULL, NULL);
|
||||
|
||||
result = isc_task_create(taskmgr, 0, &global_task);
|
||||
check_result(result, "isc_task_create");
|
||||
@ -4226,20 +4224,8 @@ destroy_libs(void) {
|
||||
debug("freeing task");
|
||||
isc_task_detach(&global_task);
|
||||
}
|
||||
/*
|
||||
* The taskmgr_destroy() and isc_nm_destroy() calls block until
|
||||
* all events are cleared.
|
||||
*/
|
||||
if (taskmgr != NULL) {
|
||||
debug("freeing taskmgr");
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
}
|
||||
|
||||
debug("closing down netmgr");
|
||||
isc_nm_closedown(netmgr);
|
||||
|
||||
debug("destroy netmgr");
|
||||
isc_nm_destroy(&netmgr);
|
||||
isc_managers_destroy(&netmgr, &taskmgr, NULL, NULL);
|
||||
|
||||
LOCK_LOOKUP;
|
||||
isc_refcount_destroy(&recvcount);
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <isc/file.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/hex.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/md.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/mutex.h>
|
||||
@ -3963,13 +3964,7 @@ main(int argc, char *argv[]) {
|
||||
print_time(outfp);
|
||||
print_version(outfp);
|
||||
|
||||
netmgr = isc_nm_start(mctx, ntasks);
|
||||
|
||||
result = isc_taskmgr_create(mctx, 0, netmgr, &taskmgr);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("failed to create task manager: %s",
|
||||
isc_result_totext(result));
|
||||
}
|
||||
isc_managers_create(mctx, ntasks, 0, 0, &netmgr, &taskmgr, NULL, NULL);
|
||||
|
||||
master = NULL;
|
||||
result = isc_task_create(taskmgr, 0, &master);
|
||||
@ -4020,8 +4015,7 @@ main(int argc, char *argv[]) {
|
||||
for (i = 0; i < (int)ntasks; i++) {
|
||||
isc_task_detach(&tasks[i]);
|
||||
}
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
isc_nm_destroy(&netmgr);
|
||||
isc_managers_destroy(&netmgr, &taskmgr, NULL, NULL);
|
||||
isc_mem_put(mctx, tasks, ntasks * sizeof(isc_task_t *));
|
||||
postsign();
|
||||
TIME_NOW(&sign_finish);
|
||||
|
@ -1164,10 +1164,10 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
|
||||
}
|
||||
#endif
|
||||
|
||||
CHECK(isc_nm_listentcp(named_g_nm, (isc_nmiface_t *)&listener->address,
|
||||
control_newconn, listener,
|
||||
sizeof(controlconnection_t), 5, NULL,
|
||||
&listener->sock));
|
||||
CHECK(isc_nm_listentcp(
|
||||
named_g_netmgr, (isc_nmiface_t *)&listener->address,
|
||||
control_newconn, listener, sizeof(controlconnection_t), 5, NULL,
|
||||
&listener->sock));
|
||||
#if 0
|
||||
/* XXX: no unix socket support yet */
|
||||
if (type == isc_socktype_unix) {
|
||||
|
@ -62,7 +62,7 @@ EXTERN bool named_g_run_done INIT(false);
|
||||
*/
|
||||
EXTERN isc_timermgr_t *named_g_timermgr INIT(NULL);
|
||||
EXTERN isc_socketmgr_t *named_g_socketmgr INIT(NULL);
|
||||
EXTERN isc_nm_t *named_g_nm INIT(NULL);
|
||||
EXTERN isc_nm_t *named_g_netmgr INIT(NULL);
|
||||
EXTERN cfg_parser_t *named_g_parser INIT(NULL);
|
||||
EXTERN cfg_parser_t *named_g_addparser INIT(NULL);
|
||||
EXTERN const char *named_g_version INIT(PACKAGE_VERSION);
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <isc/hash.h>
|
||||
#include <isc/hp.h>
|
||||
#include <isc/httpd.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/netmgr.h>
|
||||
#include <isc/os.h>
|
||||
#include <isc/platform.h>
|
||||
@ -937,45 +938,17 @@ create_managers(void) {
|
||||
"using %u UDP listener%s per interface", named_g_udpdisp,
|
||||
named_g_udpdisp == 1 ? "" : "s");
|
||||
|
||||
/*
|
||||
* We have ncpus network threads, ncpus worker threads, ncpus
|
||||
* old network threads - make it 4x just to be safe. The memory
|
||||
* impact is negligible.
|
||||
*/
|
||||
isc_hp_init(4 * named_g_cpus);
|
||||
named_g_nm = isc_nm_start(named_g_mctx, named_g_cpus);
|
||||
if (named_g_nm == NULL) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_nm_start() failed");
|
||||
return (ISC_R_UNEXPECTED);
|
||||
result = isc_managers_create(named_g_mctx, named_g_cpus,
|
||||
0 /* quantum */, maxsocks, &named_g_netmgr,
|
||||
&named_g_taskmgr, &named_g_timermgr,
|
||||
&named_g_socketmgr);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
result = isc_taskmgr_create(named_g_mctx, 0, named_g_nm,
|
||||
&named_g_taskmgr);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_taskmgr_create() failed: %s",
|
||||
isc_result_totext(result));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
|
||||
result = isc_timermgr_create(named_g_mctx, &named_g_timermgr);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_timermgr_create() failed: %s",
|
||||
isc_result_totext(result));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
|
||||
result = isc_socketmgr_create2(named_g_mctx, &named_g_socketmgr,
|
||||
maxsocks, named_g_cpus);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_socketmgr_create() failed: %s",
|
||||
isc_result_totext(result));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
isc_socketmgr_maxudp(named_g_socketmgr, maxudp);
|
||||
isc_nm_maxudp(named_g_nm, maxudp);
|
||||
isc_nm_maxudp(named_g_netmgr, maxudp);
|
||||
|
||||
result = isc_socketmgr_getmaxsockets(named_g_socketmgr, &socks);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
@ -988,21 +961,8 @@ create_managers(void) {
|
||||
|
||||
static void
|
||||
destroy_managers(void) {
|
||||
/*
|
||||
* isc_nm_closedown() closes all active connections, freeing
|
||||
* attached clients and other resources and preventing new
|
||||
* connections from being established, but it not does not
|
||||
* stop all processing or destroy the netmgr yet.
|
||||
*/
|
||||
isc_nm_closedown(named_g_nm);
|
||||
|
||||
/*
|
||||
* isc_taskmgr_destroy() will block until all tasks have exited.
|
||||
*/
|
||||
isc_taskmgr_destroy(&named_g_taskmgr);
|
||||
isc_nm_destroy(&named_g_nm);
|
||||
isc_timermgr_destroy(&named_g_timermgr);
|
||||
isc_socketmgr_destroy(&named_g_socketmgr);
|
||||
isc_managers_destroy(&named_g_netmgr, &named_g_taskmgr,
|
||||
&named_g_timermgr, &named_g_socketmgr);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -8840,7 +8840,8 @@ load_configuration(const char *filename, named_server_t *server,
|
||||
advertised = MAX_ADVERTISED_TIMEOUT;
|
||||
}
|
||||
|
||||
isc_nm_settimeouts(named_g_nm, initial, idle, keepalive, advertised);
|
||||
isc_nm_settimeouts(named_g_netmgr, initial, idle, keepalive,
|
||||
advertised);
|
||||
|
||||
/*
|
||||
* Configure sets of UDP query source ports.
|
||||
@ -9950,7 +9951,7 @@ run_server(isc_task_t *task, isc_event_t *event) {
|
||||
|
||||
CHECKFATAL(ns_interfacemgr_create(
|
||||
named_g_mctx, server->sctx, named_g_taskmgr,
|
||||
named_g_timermgr, named_g_socketmgr, named_g_nm,
|
||||
named_g_timermgr, named_g_socketmgr, named_g_netmgr,
|
||||
named_g_dispatchmgr, server->task, named_g_udpdisp,
|
||||
geoip, named_g_cpus, &server->interfacemgr),
|
||||
"creating interface manager");
|
||||
@ -10220,7 +10221,7 @@ named_server_create(isc_mem_t *mctx, named_server_t **serverp) {
|
||||
|
||||
CHECKFATAL(dns_zonemgr_create(named_g_mctx, named_g_taskmgr,
|
||||
named_g_timermgr, named_g_socketmgr,
|
||||
named_g_nm, &server->zonemgr),
|
||||
named_g_netmgr, &server->zonemgr),
|
||||
"dns_zonemgr_create");
|
||||
CHECKFATAL(dns_zonemgr_setsize(server->zonemgr, 1000), "dns_zonemgr_"
|
||||
"setsize");
|
||||
@ -10260,7 +10261,7 @@ named_server_create(isc_mem_t *mctx, named_server_t **serverp) {
|
||||
isc_sockstatscounter_max),
|
||||
"isc_stats_create");
|
||||
isc_socketmgr_setstats(named_g_socketmgr, server->sockstats);
|
||||
isc_nm_setstats(named_g_nm, server->sockstats);
|
||||
isc_nm_setstats(named_g_netmgr, server->sockstats);
|
||||
|
||||
CHECKFATAL(isc_stats_create(named_g_mctx, &server->zonestats,
|
||||
dns_zonestatscounter_max),
|
||||
@ -16342,7 +16343,7 @@ named_server_tcptimeouts(isc_lex_t *lex, isc_buffer_t **text) {
|
||||
return (ISC_R_UNEXPECTEDEND);
|
||||
}
|
||||
|
||||
isc_nm_gettimeouts(named_g_nm, &initial, &idle, &keepalive,
|
||||
isc_nm_gettimeouts(named_g_netmgr, &initial, &idle, &keepalive,
|
||||
&advertised);
|
||||
|
||||
/* Look for optional arguments. */
|
||||
@ -16396,7 +16397,7 @@ named_server_tcptimeouts(isc_lex_t *lex, isc_buffer_t **text) {
|
||||
result = isc_task_beginexclusive(named_g_server->task);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
|
||||
isc_nm_settimeouts(named_g_nm, initial, idle, keepalive,
|
||||
isc_nm_settimeouts(named_g_netmgr, initial, idle, keepalive,
|
||||
advertised);
|
||||
|
||||
isc_task_endexclusive(named_g_server->task);
|
||||
|
@ -3612,7 +3612,7 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
|
||||
CHECK(ISC_R_FAMILYNOSUPPORT);
|
||||
}
|
||||
|
||||
CHECK(isc_httpdmgr_create(named_g_nm, server->mctx, addr, client_ok,
|
||||
CHECK(isc_httpdmgr_create(named_g_netmgr, server->mctx, addr, client_ok,
|
||||
destroy_listener, listener,
|
||||
&listener->httpdmgr));
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <isc/hash.h>
|
||||
#include <isc/lex.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/nonce.h>
|
||||
#include <isc/parseint.h>
|
||||
@ -923,16 +924,8 @@ setup_system(void) {
|
||||
result = dns_dispatchmgr_create(gmctx, &dispatchmgr);
|
||||
check_result(result, "dns_dispatchmgr_create");
|
||||
|
||||
result = isc_socketmgr_create(gmctx, &socketmgr);
|
||||
check_result(result, "dns_socketmgr_create");
|
||||
|
||||
result = isc_timermgr_create(gmctx, &timermgr);
|
||||
check_result(result, "dns_timermgr_create");
|
||||
|
||||
netmgr = isc_nm_start(gmctx, 1);
|
||||
|
||||
result = isc_taskmgr_create(gmctx, 0, netmgr, &taskmgr);
|
||||
check_result(result, "isc_taskmgr_create");
|
||||
isc_managers_create(gmctx, 1, 0, 0, &netmgr, &taskmgr, &timermgr,
|
||||
&socketmgr);
|
||||
|
||||
result = isc_task_create(taskmgr, 0, &global_task);
|
||||
check_result(result, "isc_task_create");
|
||||
@ -3325,21 +3318,12 @@ cleanup(void) {
|
||||
dst_key_free(&sig0key);
|
||||
}
|
||||
|
||||
ddebug("Shutting down task manager");
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
|
||||
ddebug("Shutting down network manager");
|
||||
isc_nm_destroy(&netmgr);
|
||||
ddebug("Shutting down managers");
|
||||
isc_managers_destroy(&netmgr, &taskmgr, &timermgr, &socketmgr);
|
||||
|
||||
ddebug("Destroying event");
|
||||
isc_event_free(&global_event);
|
||||
|
||||
ddebug("Shutting down socket manager");
|
||||
isc_socketmgr_destroy(&socketmgr);
|
||||
|
||||
ddebug("Shutting down timer manager");
|
||||
isc_timermgr_destroy(&timermgr);
|
||||
|
||||
#ifdef HAVE_GSSAPI
|
||||
/*
|
||||
* Cleanup GSSAPI resources after taskmgr has been destroyed.
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/file.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/net.h>
|
||||
#include <isc/netmgr.h>
|
||||
@ -59,6 +60,7 @@
|
||||
const char *progname = NULL;
|
||||
bool verbose;
|
||||
|
||||
static isc_nm_t *netmgr = NULL;
|
||||
static isc_taskmgr_t *taskmgr = NULL;
|
||||
static isc_task_t *rndc_task = NULL;
|
||||
|
||||
@ -72,7 +74,6 @@ static bool local4set = false, local6set = false;
|
||||
static int nserveraddrs;
|
||||
static int currentaddr = 0;
|
||||
static unsigned int remoteport = 0;
|
||||
static isc_nm_t *netmgr = NULL;
|
||||
static isc_buffer_t *databuf = NULL;
|
||||
static isccc_ccmsg_t rndc_ccmsg;
|
||||
static uint32_t algorithm;
|
||||
@ -1030,9 +1031,7 @@ main(int argc, char **argv) {
|
||||
serial = isc_random32();
|
||||
|
||||
isc_mem_create(&rndc_mctx);
|
||||
netmgr = isc_nm_start(rndc_mctx, 1);
|
||||
DO("create task manager",
|
||||
isc_taskmgr_create(rndc_mctx, 0, netmgr, &taskmgr));
|
||||
isc_managers_create(rndc_mctx, 1, 0, 0, &netmgr, &taskmgr, NULL, NULL);
|
||||
DO("create task", isc_task_create(taskmgr, 0, &rndc_task));
|
||||
isc_log_create(rndc_mctx, &log, &logconfig);
|
||||
isc_log_setcontext(log);
|
||||
@ -1089,9 +1088,7 @@ main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
isc_task_detach(&rndc_task);
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
|
||||
isc_nm_closedown(netmgr);
|
||||
isc_managers_destroy(&netmgr, &taskmgr, NULL, NULL);
|
||||
|
||||
/*
|
||||
* Note: when TCP connections are shut down, there will be a final
|
||||
@ -1101,8 +1098,6 @@ main(int argc, char **argv) {
|
||||
*/
|
||||
isccc_ccmsg_invalidate(&rndc_ccmsg);
|
||||
|
||||
isc_nm_destroy(&netmgr);
|
||||
|
||||
isc_log_destroy(&log);
|
||||
isc_log_setcontext(NULL);
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/net.h>
|
||||
#include <isc/parseint.h>
|
||||
@ -208,10 +209,10 @@ main(int argc, char *argv[]) {
|
||||
isc_logconfig_t *lcfg;
|
||||
isc_nm_t *netmgr = NULL;
|
||||
isc_taskmgr_t *taskmgr = NULL;
|
||||
isc_task_t *task;
|
||||
isc_timermgr_t *timermgr;
|
||||
isc_socketmgr_t *socketmgr;
|
||||
dns_dispatchmgr_t *dispatchmgr;
|
||||
isc_task_t *task = NULL;
|
||||
isc_timermgr_t *timermgr = NULL;
|
||||
isc_socketmgr_t *socketmgr = NULL;
|
||||
dns_dispatchmgr_t *dispatchmgr = NULL;
|
||||
unsigned int attrs, attrmask;
|
||||
dns_dispatch_t *dispatchv4;
|
||||
dns_view_t *view;
|
||||
@ -277,17 +278,10 @@ main(int argc, char *argv[]) {
|
||||
|
||||
RUNCHECK(dst_lib_init(mctx, NULL));
|
||||
|
||||
netmgr = isc_nm_start(mctx, 1);
|
||||
isc_managers_create(mctx, 1, 0, 0, &netmgr, &taskmgr, &timermgr,
|
||||
&socketmgr);
|
||||
|
||||
RUNCHECK(isc_taskmgr_create(mctx, 0, netmgr, &taskmgr));
|
||||
task = NULL;
|
||||
RUNCHECK(isc_task_create(taskmgr, 0, &task));
|
||||
timermgr = NULL;
|
||||
|
||||
RUNCHECK(isc_timermgr_create(mctx, &timermgr));
|
||||
socketmgr = NULL;
|
||||
RUNCHECK(isc_socketmgr_create(mctx, &socketmgr));
|
||||
dispatchmgr = NULL;
|
||||
RUNCHECK(dns_dispatchmgr_create(mctx, &dispatchmgr));
|
||||
|
||||
attrs = DNS_DISPATCHATTR_UDP | DNS_DISPATCHATTR_MAKEQUERY |
|
||||
@ -318,13 +312,10 @@ main(int argc, char *argv[]) {
|
||||
dns_dispatch_detach(&dispatchv4);
|
||||
dns_dispatchmgr_destroy(&dispatchmgr);
|
||||
|
||||
isc_socketmgr_destroy(&socketmgr);
|
||||
isc_timermgr_destroy(&timermgr);
|
||||
|
||||
isc_task_shutdown(task);
|
||||
isc_task_detach(&task);
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
isc_nm_destroy(&netmgr);
|
||||
|
||||
isc_managers_destroy(&netmgr, &taskmgr, &timermgr, &socketmgr);
|
||||
|
||||
dst_lib_destroy();
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/lib.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/sockaddr.h>
|
||||
@ -66,25 +67,8 @@ isc_timermgr_t *ctxs_timermgr = NULL;
|
||||
|
||||
static void
|
||||
ctxs_destroy(void) {
|
||||
if (ctxs_netmgr != NULL) {
|
||||
isc_nm_closedown(ctxs_netmgr);
|
||||
}
|
||||
|
||||
if (ctxs_taskmgr != NULL) {
|
||||
isc_taskmgr_destroy(&ctxs_taskmgr);
|
||||
}
|
||||
|
||||
if (ctxs_netmgr != NULL) {
|
||||
isc_nm_destroy(&ctxs_netmgr);
|
||||
}
|
||||
|
||||
if (ctxs_timermgr != NULL) {
|
||||
isc_timermgr_destroy(&ctxs_timermgr);
|
||||
}
|
||||
|
||||
if (ctxs_socketmgr != NULL) {
|
||||
isc_socketmgr_destroy(&ctxs_socketmgr);
|
||||
}
|
||||
isc_managers_destroy(&ctxs_netmgr, &ctxs_taskmgr, &ctxs_timermgr,
|
||||
&ctxs_socketmgr);
|
||||
|
||||
if (ctxs_actx != NULL) {
|
||||
isc_appctx_destroy(&ctxs_actx);
|
||||
@ -106,22 +90,8 @@ ctxs_init(void) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ctxs_netmgr = isc_nm_start(ctxs_mctx, 1);
|
||||
|
||||
result = isc_taskmgr_create(ctxs_mctx, 0, ctxs_netmgr, &ctxs_taskmgr);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
result = isc_socketmgr_create(ctxs_mctx, &ctxs_socketmgr);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
result = isc_timermgr_create(ctxs_mctx, &ctxs_timermgr);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto fail;
|
||||
}
|
||||
isc_managers_create(ctxs_mctx, 1, 0, 0, &ctxs_netmgr, &ctxs_taskmgr,
|
||||
&ctxs_timermgr, &ctxs_socketmgr);
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <isc/base64.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/nonce.h>
|
||||
#include <isc/print.h>
|
||||
@ -191,21 +192,21 @@ sendquery(isc_task_t *task, isc_event_t *event) {
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
char *ourkeyname;
|
||||
char *ourkeyname = NULL;
|
||||
isc_nm_t *netmgr = NULL;
|
||||
isc_taskmgr_t *taskmgr = NULL;
|
||||
isc_timermgr_t *timermgr;
|
||||
isc_socketmgr_t *socketmgr;
|
||||
isc_socket_t *sock;
|
||||
isc_timermgr_t *timermgr = NULL;
|
||||
isc_socketmgr_t *socketmgr = NULL;
|
||||
isc_socket_t *sock = NULL;
|
||||
unsigned int attrs, attrmask;
|
||||
isc_sockaddr_t bind_any;
|
||||
dns_dispatchmgr_t *dispatchmgr;
|
||||
dns_dispatch_t *dispatchv4;
|
||||
dns_view_t *view;
|
||||
dns_tkeyctx_t *tctx;
|
||||
isc_log_t *log;
|
||||
isc_logconfig_t *logconfig;
|
||||
isc_task_t *task;
|
||||
dns_dispatchmgr_t *dispatchmgr = NULL;
|
||||
dns_dispatch_t *dispatchv4 = NULL;
|
||||
dns_view_t *view = NULL;
|
||||
dns_tkeyctx_t *tctx = NULL;
|
||||
isc_log_t *log = NULL;
|
||||
isc_logconfig_t *logconfig = NULL;
|
||||
isc_task_t *task = NULL;
|
||||
isc_result_t result;
|
||||
int type;
|
||||
|
||||
@ -235,17 +236,12 @@ main(int argc, char *argv[]) {
|
||||
|
||||
RUNCHECK(dst_lib_init(mctx, NULL));
|
||||
|
||||
netmgr = isc_nm_start(mctx, 1);
|
||||
isc_managers_create(mctx, 1, 0, 0, &netmgr, &taskmgr, &timermgr,
|
||||
&socketmgr);
|
||||
|
||||
RUNCHECK(isc_taskmgr_create(mctx, 0, netmgr, &taskmgr));
|
||||
task = NULL;
|
||||
RUNCHECK(isc_task_create(taskmgr, 0, &task));
|
||||
timermgr = NULL;
|
||||
RUNCHECK(isc_timermgr_create(mctx, &timermgr));
|
||||
socketmgr = NULL;
|
||||
RUNCHECK(isc_socketmgr_create(mctx, &socketmgr));
|
||||
dispatchmgr = NULL;
|
||||
RUNCHECK(dns_dispatchmgr_create(mctx, &dispatchmgr));
|
||||
|
||||
isc_sockaddr_any(&bind_any);
|
||||
attrs = DNS_DISPATCHATTR_UDP | DNS_DISPATCHATTR_MAKEQUERY |
|
||||
DNS_DISPATCHATTR_IPV4;
|
||||
@ -293,11 +289,8 @@ main(int argc, char *argv[]) {
|
||||
dns_dispatchmgr_destroy(&dispatchmgr);
|
||||
isc_task_shutdown(task);
|
||||
isc_task_detach(&task);
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
isc_nm_destroy(&netmgr);
|
||||
isc_socket_detach(&sock);
|
||||
isc_socketmgr_destroy(&socketmgr);
|
||||
isc_timermgr_destroy(&timermgr);
|
||||
isc_managers_destroy(&netmgr, &taskmgr, &timermgr, &socketmgr);
|
||||
|
||||
dst_key_free(&ourkey);
|
||||
dns_tsigkey_detach(&initialkey);
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <isc/base64.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/netmgr.h>
|
||||
#include <isc/print.h>
|
||||
@ -135,22 +136,22 @@ sendquery(isc_task_t *task, isc_event_t *event) {
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
char *keyname;
|
||||
isc_nm_t *netmgr;
|
||||
char *keyname = NULL;
|
||||
isc_nm_t *netmgr = NULL;
|
||||
isc_taskmgr_t *taskmgr = NULL;
|
||||
isc_timermgr_t *timermgr;
|
||||
isc_socketmgr_t *socketmgr;
|
||||
isc_socket_t *sock;
|
||||
isc_timermgr_t *timermgr = NULL;
|
||||
isc_socketmgr_t *socketmgr = NULL;
|
||||
isc_socket_t *sock = NULL;
|
||||
unsigned int attrs, attrmask;
|
||||
isc_sockaddr_t bind_any;
|
||||
dns_dispatchmgr_t *dispatchmgr;
|
||||
dns_dispatch_t *dispatchv4;
|
||||
dns_view_t *view;
|
||||
dns_tkeyctx_t *tctx;
|
||||
dst_key_t *dstkey;
|
||||
isc_log_t *log;
|
||||
isc_logconfig_t *logconfig;
|
||||
isc_task_t *task;
|
||||
dns_dispatchmgr_t *dispatchmgr = NULL;
|
||||
dns_dispatch_t *dispatchv4 = NULL;
|
||||
dns_view_t *view = NULL;
|
||||
dns_tkeyctx_t *tctx = NULL;
|
||||
dst_key_t *dstkey = NULL;
|
||||
isc_log_t *log = NULL;
|
||||
isc_logconfig_t *logconfig = NULL;
|
||||
isc_task_t *task = NULL;
|
||||
isc_result_t result;
|
||||
int type;
|
||||
|
||||
@ -179,16 +180,10 @@ main(int argc, char **argv) {
|
||||
|
||||
RUNCHECK(dst_lib_init(mctx, NULL));
|
||||
|
||||
netmgr = isc_nm_start(mctx, 1);
|
||||
isc_managers_create(mctx, 1, 0, 0, &netmgr, &taskmgr, &timermgr,
|
||||
&socketmgr);
|
||||
|
||||
RUNCHECK(isc_taskmgr_create(mctx, 0, netmgr, &taskmgr));
|
||||
task = NULL;
|
||||
RUNCHECK(isc_task_create(taskmgr, 0, &task));
|
||||
timermgr = NULL;
|
||||
RUNCHECK(isc_timermgr_create(mctx, &timermgr));
|
||||
socketmgr = NULL;
|
||||
RUNCHECK(isc_socketmgr_create(mctx, &socketmgr));
|
||||
dispatchmgr = NULL;
|
||||
RUNCHECK(dns_dispatchmgr_create(mctx, &dispatchmgr));
|
||||
isc_sockaddr_any(&bind_any);
|
||||
attrs = DNS_DISPATCHATTR_UDP | DNS_DISPATCHATTR_MAKEQUERY |
|
||||
@ -237,11 +232,8 @@ main(int argc, char **argv) {
|
||||
dns_dispatchmgr_destroy(&dispatchmgr);
|
||||
isc_task_shutdown(task);
|
||||
isc_task_detach(&task);
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
isc_nm_destroy(&netmgr);
|
||||
isc_socket_detach(&sock);
|
||||
isc_socketmgr_destroy(&socketmgr);
|
||||
isc_timermgr_destroy(&timermgr);
|
||||
isc_managers_destroy(&netmgr, &taskmgr, &timermgr, &socketmgr);
|
||||
|
||||
dns_tsigkeyring_detach(&ring);
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/managers.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/netmgr.h>
|
||||
@ -307,7 +308,7 @@ setup(void) {
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
netmgr = isc_nm_start(mctx, workers);
|
||||
isc_managers_create(mctx, workers, 0, 0, &netmgr, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -316,7 +317,7 @@ teardown(void) {
|
||||
close(out);
|
||||
}
|
||||
|
||||
isc_nm_destroy(&netmgr);
|
||||
isc_managers_destroy(&netmgr, NULL, NULL, NULL);
|
||||
isc_mem_destroy(&mctx);
|
||||
if (tls_ctx) {
|
||||
isc_tlsctx_free(&tls_ctx);
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include <isc/managers.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/netmgr.h>
|
||||
@ -188,12 +189,12 @@ setup(void) {
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
netmgr = isc_nm_start(mctx, workers);
|
||||
isc_managers_create(mctx, workers, 0, 0, &netmgr, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
teardown(void) {
|
||||
isc_nm_destroy(&netmgr);
|
||||
isc_managers_destroy(&netmgr, NULL, NULL, NULL);
|
||||
isc_mem_destroy(&mctx);
|
||||
if (tls_ctx) {
|
||||
isc_tlsctx_free(&tls_ctx);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <isc/hash.h>
|
||||
#include <isc/hex.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/net.h>
|
||||
#include <isc/nonce.h>
|
||||
@ -2070,10 +2071,10 @@ main(int argc, char *argv[]) {
|
||||
isc_logconfig_t *lcfg;
|
||||
isc_nm_t *netmgr = NULL;
|
||||
isc_taskmgr_t *taskmgr = NULL;
|
||||
isc_task_t *task;
|
||||
isc_timermgr_t *timermgr;
|
||||
isc_socketmgr_t *socketmgr;
|
||||
dns_dispatchmgr_t *dispatchmgr;
|
||||
isc_task_t *task = NULL;
|
||||
isc_timermgr_t *timermgr = NULL;
|
||||
isc_socketmgr_t *socketmgr = NULL;
|
||||
dns_dispatchmgr_t *dispatchmgr = NULL;
|
||||
unsigned int attrs, attrmask;
|
||||
dns_dispatch_t *dispatchvx;
|
||||
dns_view_t *view;
|
||||
@ -2130,17 +2131,11 @@ main(int argc, char *argv[]) {
|
||||
fatal("can't choose between IPv4 and IPv6");
|
||||
}
|
||||
|
||||
netmgr = isc_nm_start(mctx, 1);
|
||||
isc_managers_create(mctx, 1, 0, 0, &netmgr, &taskmgr, &timermgr,
|
||||
&socketmgr);
|
||||
|
||||
RUNCHECK(isc_taskmgr_create(mctx, 0, netmgr, &taskmgr));
|
||||
task = NULL;
|
||||
RUNCHECK(isc_task_create(taskmgr, 0, &task));
|
||||
timermgr = NULL;
|
||||
|
||||
RUNCHECK(isc_timermgr_create(mctx, &timermgr));
|
||||
socketmgr = NULL;
|
||||
RUNCHECK(isc_socketmgr_create(mctx, &socketmgr));
|
||||
dispatchmgr = NULL;
|
||||
RUNCHECK(dns_dispatchmgr_create(mctx, &dispatchmgr));
|
||||
|
||||
attrs = DNS_DISPATCHATTR_UDP | DNS_DISPATCHATTR_MAKEQUERY;
|
||||
@ -2206,13 +2201,10 @@ main(int argc, char *argv[]) {
|
||||
dns_dispatch_detach(&dispatchvx);
|
||||
dns_dispatchmgr_destroy(&dispatchmgr);
|
||||
|
||||
isc_socketmgr_destroy(&socketmgr);
|
||||
isc_timermgr_destroy(&timermgr);
|
||||
|
||||
isc_task_shutdown(task);
|
||||
isc_task_detach(&task);
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
isc_nm_destroy(&netmgr);
|
||||
|
||||
isc_managers_destroy(&netmgr, &taskmgr, &timermgr, &socketmgr);
|
||||
|
||||
dst_lib_destroy();
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <isc/hash.h>
|
||||
#include <isc/hex.h>
|
||||
#include <isc/lex.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/os.h>
|
||||
#include <isc/print.h>
|
||||
@ -95,18 +96,7 @@ cleanup_managers(void) {
|
||||
isc_task_shutdown(maintask);
|
||||
isc_task_destroy(&maintask);
|
||||
}
|
||||
if (socketmgr != NULL) {
|
||||
isc_socketmgr_destroy(&socketmgr);
|
||||
}
|
||||
if (taskmgr != NULL) {
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
}
|
||||
if (netmgr != NULL) {
|
||||
isc_nm_destroy(&netmgr);
|
||||
}
|
||||
if (timermgr != NULL) {
|
||||
isc_timermgr_destroy(&timermgr);
|
||||
}
|
||||
isc_managers_destroy(&netmgr, &taskmgr, &timermgr, &socketmgr);
|
||||
if (app_running) {
|
||||
isc_app_finish();
|
||||
}
|
||||
@ -117,10 +107,8 @@ create_managers(void) {
|
||||
isc_result_t result;
|
||||
ncpus = isc_os_ncpus();
|
||||
|
||||
netmgr = isc_nm_start(dt_mctx, ncpus);
|
||||
CHECK(isc_taskmgr_create(dt_mctx, 0, netmgr, &taskmgr));
|
||||
CHECK(isc_timermgr_create(dt_mctx, &timermgr));
|
||||
CHECK(isc_socketmgr_create(dt_mctx, &socketmgr));
|
||||
isc_managers_create(dt_mctx, ncpus, 0, 0, &netmgr, &taskmgr, &timermgr,
|
||||
&socketmgr);
|
||||
CHECK(isc_task_create(taskmgr, 0, &maintask));
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
|
@ -46,6 +46,7 @@ libisc_la_HEADERS = \
|
||||
include/isc/list.h \
|
||||
include/isc/log.h \
|
||||
include/isc/magic.h \
|
||||
include/isc/managers.h \
|
||||
include/isc/md.h \
|
||||
include/isc/mem.h \
|
||||
include/isc/meminfo.h \
|
||||
@ -182,6 +183,7 @@ libisc_la_SOURCES = \
|
||||
lex.c \
|
||||
lib.c \
|
||||
log.c \
|
||||
managers.c \
|
||||
md.c \
|
||||
mem.c \
|
||||
mutexblock.c \
|
||||
@ -222,6 +224,10 @@ libisc_la_SOURCES = \
|
||||
pthreads/thread.c \
|
||||
entropy_private.h \
|
||||
fsaccess_common_p.h \
|
||||
task_p.h \
|
||||
timer_p.h \
|
||||
socket_p.h \
|
||||
netmgr_p.h \
|
||||
lib_p.h \
|
||||
mem_p.h \
|
||||
tls_p.h
|
||||
|
@ -82,6 +82,9 @@ tid(void) {
|
||||
|
||||
void
|
||||
isc_hp_init(int max_threads) {
|
||||
if (isc__hp_max_threads > max_threads) {
|
||||
return;
|
||||
}
|
||||
isc__hp_max_threads = max_threads;
|
||||
isc__hp_max_retired = max_threads * HP_MAX_HPS;
|
||||
}
|
||||
|
@ -66,8 +66,10 @@ typedef void(isc_hp_deletefunc_t)(void *);
|
||||
void
|
||||
isc_hp_init(int max_threads);
|
||||
/*%<
|
||||
* Initialize hazard pointer constants - isc__hp_max_threads. If more threads
|
||||
* will try to access hp it will assert.
|
||||
* Initialize hazard pointer constants, isc__hp_max_threads and
|
||||
* isc__hp_max_retired. If more threads try to access hp, it
|
||||
* will assert. Calling this function repeatedly can be used
|
||||
* to increase the limits, but cannot reduce them.
|
||||
*/
|
||||
|
||||
isc_hp_t *
|
||||
|
30
lib/isc/include/isc/managers.h
Normal file
30
lib/isc/include/isc/managers.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <isc/netmgr.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/socket.h>
|
||||
#include <isc/task.h>
|
||||
#include <isc/timer.h>
|
||||
|
||||
typedef struct isc_managers isc_managers_t;
|
||||
|
||||
isc_result_t
|
||||
isc_managers_create(isc_mem_t *mctx, size_t workers, size_t quantum,
|
||||
size_t sockets, isc_nm_t **netmgrp,
|
||||
isc_taskmgr_t **taskmgrp, isc_timermgr_t **timermgrp,
|
||||
isc_socketmgr_t **socketmgrp);
|
||||
|
||||
void
|
||||
isc_managers_destroy(isc_nm_t **netmgrp, isc_taskmgr_t **taskmgrp,
|
||||
isc_timermgr_t **timermgrp, isc_socketmgr_t **socketmgrp);
|
@ -68,19 +68,10 @@ typedef void (*isc_nm_opaquecb_t)(void *arg);
|
||||
* callbacks.
|
||||
*/
|
||||
|
||||
isc_nm_t *
|
||||
isc_nm_start(isc_mem_t *mctx, uint32_t workers);
|
||||
/*%<
|
||||
* Creates a new network manager with 'workers' worker threads,
|
||||
* and starts it running.
|
||||
*/
|
||||
|
||||
void
|
||||
isc_nm_attach(isc_nm_t *mgr, isc_nm_t **dst);
|
||||
void
|
||||
isc_nm_detach(isc_nm_t **mgr0);
|
||||
void
|
||||
isc_nm_destroy(isc_nm_t **mgr0);
|
||||
/*%<
|
||||
* Attach/detach a network manager. When all references have been
|
||||
* released, the network manager is shut down, freeing all resources.
|
||||
|
@ -9,8 +9,7 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#ifndef ISC_SOCKET_H
|
||||
#define ISC_SOCKET_H 1
|
||||
#pragma once
|
||||
|
||||
/*****
|
||||
***** Module Info
|
||||
@ -676,42 +675,6 @@ isc_socket_sendto2(isc_socket_t *sock, isc_region_t *region, isc_task_t *task,
|
||||
*/
|
||||
/*@}*/
|
||||
|
||||
isc_result_t
|
||||
isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp);
|
||||
|
||||
isc_result_t
|
||||
isc_socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp,
|
||||
unsigned int maxsocks, int nthreads);
|
||||
/*%<
|
||||
* Create a socket manager. If "maxsocks" is non-zero, it specifies the
|
||||
* maximum number of sockets that the created manager should handle.
|
||||
* isc_socketmgr_create() is equivalent of isc_socketmgr_create2() with
|
||||
* "maxsocks" being zero.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*\li All memory will be allocated in memory context 'mctx'.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li 'mctx' is a valid memory context.
|
||||
*
|
||||
*\li 'managerp' points to a NULL isc_socketmgr_t.
|
||||
*
|
||||
*\li 'actx' is a valid application context (for createinctx()).
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
*\li '*managerp' is a valid isc_socketmgr_t.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
*\li #ISC_R_SUCCESS
|
||||
*\li #ISC_R_NOMEMORY
|
||||
*\li #ISC_R_UNEXPECTED
|
||||
*\li #ISC_R_NOTIMPLEMENTED
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
isc_socketmgr_getmaxsockets(isc_socketmgr_t *manager, unsigned int *nsockp);
|
||||
/*%<
|
||||
@ -741,31 +704,6 @@ isc_socketmgr_setstats(isc_socketmgr_t *manager, isc_stats_t *stats);
|
||||
* (see above).
|
||||
*/
|
||||
|
||||
void
|
||||
isc_socketmgr_destroy(isc_socketmgr_t **managerp);
|
||||
/*%<
|
||||
* Destroy a socket manager.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*\li This routine blocks until there are no sockets left in the manager,
|
||||
* so if the caller holds any socket references using the manager, it
|
||||
* must detach them before calling isc_socketmgr_destroy() or it will
|
||||
* block forever.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li '*managerp' is a valid isc_socketmgr_t.
|
||||
*
|
||||
*\li All sockets managed by this manager are fully detached.
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
*\li *managerp == NULL
|
||||
*
|
||||
*\li All resources used by the manager have been freed.
|
||||
*/
|
||||
|
||||
isc_sockettype_t
|
||||
isc_socket_gettype(isc_socket_t *sock);
|
||||
/*%<
|
||||
@ -908,5 +846,3 @@ typedef isc_result_t (*isc_socketmgrcreatefunc_t)(isc_mem_t * mctx,
|
||||
isc_socketmgr_t **managerp);
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif /* ISC_SOCKET_H */
|
||||
|
@ -9,8 +9,7 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#ifndef ISC_TASK_H
|
||||
#define ISC_TASK_H 1
|
||||
#pragma once
|
||||
|
||||
/*****
|
||||
***** Module Info
|
||||
@ -626,81 +625,11 @@ isc_task_privilege(isc_task_t *task);
|
||||
***** Task Manager.
|
||||
*****/
|
||||
|
||||
isc_result_t
|
||||
isc_taskmgr_create(isc_mem_t *mctx, unsigned int default_quantum, isc_nm_t *nm,
|
||||
isc_taskmgr_t **managerp);
|
||||
/*%<
|
||||
* Create a new task manager.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*\li If 'default_quantum' is non-zero, then it will be used as the default
|
||||
* quantum value when tasks are created. If zero, then an implementation
|
||||
* defined default quantum will be used.
|
||||
*
|
||||
*\li If 'nm' is set then netmgr is paused when an exclusive task mode
|
||||
* is requested.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li 'mctx' is a valid memory context.
|
||||
*
|
||||
*\li managerp != NULL && *managerp == NULL
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
*\li On success, '*managerp' will be attached to the newly created task
|
||||
* manager.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
*\li #ISC_R_SUCCESS
|
||||
*\li #ISC_R_NOMEMORY
|
||||
*\li #ISC_R_NOTHREADS No threads could be created.
|
||||
*\li #ISC_R_UNEXPECTED An unexpected error occurred.
|
||||
*\li #ISC_R_SHUTTINGDOWN The non-threaded, shared, task
|
||||
* manager shutting down.
|
||||
*/
|
||||
|
||||
void
|
||||
isc_taskmgr_attach(isc_taskmgr_t *, isc_taskmgr_t **);
|
||||
void
|
||||
isc_taskmgr_detach(isc_taskmgr_t *);
|
||||
|
||||
void
|
||||
isc_taskmgr_destroy(isc_taskmgr_t **managerp);
|
||||
/*%<
|
||||
* Destroy '*managerp'.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*\li Calling isc_taskmgr_destroy() will shutdown all tasks managed by
|
||||
* *managerp that haven't already been shutdown. The call will block
|
||||
* until all tasks have entered the done state.
|
||||
*
|
||||
*\li isc_taskmgr_destroy() must not be called by a task event action,
|
||||
* because it would block forever waiting for the event action to
|
||||
* complete. An event action that wants to cause task manager shutdown
|
||||
* should request some non-event action thread of execution to do the
|
||||
* shutdown, e.g. by signaling a condition variable or using
|
||||
* isc_app_shutdown().
|
||||
*
|
||||
*\li Task manager references are not reference counted, so the caller
|
||||
* must ensure that no attempt will be made to use the manager after
|
||||
* isc_taskmgr_destroy() returns.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li '*managerp' is a valid task manager.
|
||||
*
|
||||
*\li isc_taskmgr_destroy() has not be called previously on '*managerp'.
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
*\li All resources used by the task manager, and any tasks it managed,
|
||||
* have been freed.
|
||||
*/
|
||||
|
||||
void
|
||||
isc_taskmgr_setexcltask(isc_taskmgr_t *mgr, isc_task_t *task);
|
||||
/*%<
|
||||
@ -736,5 +665,3 @@ isc_taskmgr_renderjson(isc_taskmgr_t *mgr, void *tasksobj0);
|
||||
#endif /* HAVE_JSON_C */
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif /* ISC_TASK_H */
|
||||
|
@ -9,8 +9,7 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#ifndef ISC_TIMER_H
|
||||
#define ISC_TIMER_H 1
|
||||
#pragma once
|
||||
|
||||
/*****
|
||||
***** Module Info
|
||||
@ -276,58 +275,7 @@ isc_timer_gettype(isc_timer_t *timer);
|
||||
*\li 'timer' to be a valid timer.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp);
|
||||
/*%<
|
||||
* Create a timer manager.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*\li All memory will be allocated in memory context 'mctx'.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li 'mctx' is a valid memory context.
|
||||
*
|
||||
*\li 'managerp' points to a NULL isc_timermgr_t.
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
*\li '*managerp' is a valid isc_timermgr_t.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
*\li Success
|
||||
*\li No memory
|
||||
*\li Unexpected error
|
||||
*/
|
||||
|
||||
void
|
||||
isc_timermgr_destroy(isc_timermgr_t **managerp);
|
||||
/*%<
|
||||
* Destroy a timer manager.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*\li This routine blocks until there are no timers left in the manager,
|
||||
* so if the caller holds any timer references using the manager, it
|
||||
* must detach them before calling isc_timermgr_destroy() or it will
|
||||
* block forever.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li '*managerp' is a valid isc_timermgr_t.
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
*\li *managerp == NULL
|
||||
*
|
||||
*\li All resources used by the manager have been freed.
|
||||
*/
|
||||
|
||||
void
|
||||
isc_timermgr_poke(isc_timermgr_t *m);
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif /* ISC_TIMER_H */
|
||||
|
109
lib/isc/managers.c
Normal file
109
lib/isc/managers.c
Normal file
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <isc/hp.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include "netmgr_p.h"
|
||||
#include "socket_p.h"
|
||||
#include "task_p.h"
|
||||
#include "timer_p.h"
|
||||
|
||||
isc_result_t
|
||||
isc_managers_create(isc_mem_t *mctx, size_t workers, size_t quantum,
|
||||
size_t sockets, isc_nm_t **netmgrp,
|
||||
isc_taskmgr_t **taskmgrp, isc_timermgr_t **timermgrp,
|
||||
isc_socketmgr_t **socketmgrp) {
|
||||
isc_result_t result;
|
||||
isc_nm_t *netmgr = NULL;
|
||||
isc_socketmgr_t *socketmgr = NULL;
|
||||
isc_taskmgr_t *taskmgr = NULL;
|
||||
isc_timermgr_t *timermgr = NULL;
|
||||
|
||||
/*
|
||||
* We have ncpus network threads, ncpus old network threads - make
|
||||
* it 4x just to be on the safe side.
|
||||
*/
|
||||
isc_hp_init(4 * workers);
|
||||
|
||||
REQUIRE(netmgrp != NULL && *netmgrp == NULL);
|
||||
isc__netmgr_create(mctx, workers, &netmgr);
|
||||
*netmgrp = netmgr;
|
||||
INSIST(netmgr != NULL);
|
||||
|
||||
REQUIRE(taskmgrp == NULL || *taskmgrp == NULL);
|
||||
if (taskmgrp != NULL) {
|
||||
result = isc__taskmgr_create(mctx, quantum, netmgr, &taskmgr);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_taskmgr_create() failed: %s",
|
||||
isc_result_totext(result));
|
||||
goto fail;
|
||||
}
|
||||
*taskmgrp = taskmgr;
|
||||
}
|
||||
|
||||
REQUIRE(timermgrp == NULL || *timermgrp == NULL);
|
||||
if (timermgrp != NULL) {
|
||||
result = isc__timermgr_create(mctx, &timermgr);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_timermgr_create() failed: %s",
|
||||
isc_result_totext(result));
|
||||
goto fail;
|
||||
}
|
||||
*timermgrp = timermgr;
|
||||
}
|
||||
|
||||
REQUIRE(socketmgrp == NULL || *socketmgrp == NULL);
|
||||
if (socketmgrp != NULL) {
|
||||
result = isc__socketmgr_create(mctx, &socketmgr, sockets,
|
||||
workers);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_socketmgr_create() failed: %s",
|
||||
isc_result_totext(result));
|
||||
goto fail;
|
||||
}
|
||||
*socketmgrp = socketmgr;
|
||||
}
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
fail:
|
||||
isc_managers_destroy(netmgrp, taskmgrp, timermgrp, socketmgrp);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
void
|
||||
isc_managers_destroy(isc_nm_t **netmgrp, isc_taskmgr_t **taskmgrp,
|
||||
isc_timermgr_t **timermgrp, isc_socketmgr_t **socketmgrp) {
|
||||
if (netmgrp != NULL && *netmgrp != NULL) {
|
||||
isc_nm_closedown(*netmgrp);
|
||||
}
|
||||
|
||||
if (taskmgrp != NULL && *taskmgrp != NULL) {
|
||||
isc__taskmgr_destroy(taskmgrp);
|
||||
}
|
||||
|
||||
if (netmgrp != NULL && *netmgrp != NULL) {
|
||||
isc__netmgr_destroy(netmgrp);
|
||||
}
|
||||
|
||||
if (timermgrp != NULL && *timermgrp != NULL) {
|
||||
isc__timermgr_destroy(timermgrp);
|
||||
}
|
||||
|
||||
if (socketmgrp != NULL && *socketmgrp != NULL) {
|
||||
isc__socketmgr_destroy(socketmgrp);
|
||||
}
|
||||
}
|
@ -37,6 +37,7 @@
|
||||
#include <isc/util.h>
|
||||
|
||||
#include "netmgr-int.h"
|
||||
#include "netmgr_p.h"
|
||||
#include "openssl_shim.h"
|
||||
#include "uv-compat.h"
|
||||
|
||||
@ -206,8 +207,8 @@ isc__nm_winsock_destroy(void) {
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
||||
isc_nm_t *
|
||||
isc_nm_start(isc_mem_t *mctx, uint32_t workers) {
|
||||
void
|
||||
isc__netmgr_create(isc_mem_t *mctx, uint32_t workers, isc_nm_t **netmgrp) {
|
||||
isc_nm_t *mgr = NULL;
|
||||
char name[32];
|
||||
|
||||
@ -296,7 +297,7 @@ isc_nm_start(isc_mem_t *mctx, uint32_t workers) {
|
||||
}
|
||||
|
||||
mgr->magic = NM_MAGIC;
|
||||
return (mgr);
|
||||
*netmgrp = mgr;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -485,14 +486,13 @@ isc_nm_closedown(isc_nm_t *mgr) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_nm_destroy(isc_nm_t **mgr0) {
|
||||
isc__netmgr_destroy(isc_nm_t **netmgrp) {
|
||||
isc_nm_t *mgr = NULL;
|
||||
int counter = 0;
|
||||
|
||||
REQUIRE(mgr0 != NULL);
|
||||
REQUIRE(VALID_NM(*mgr0));
|
||||
REQUIRE(VALID_NM(*netmgrp));
|
||||
|
||||
mgr = *mgr0;
|
||||
mgr = *netmgrp;
|
||||
|
||||
/*
|
||||
* Close active connections.
|
||||
@ -524,7 +524,7 @@ isc_nm_destroy(isc_nm_t **mgr0) {
|
||||
/*
|
||||
* Detach final reference.
|
||||
*/
|
||||
isc_nm_detach(mgr0);
|
||||
isc_nm_detach(netmgrp);
|
||||
}
|
||||
|
||||
void
|
||||
|
29
lib/isc/netmgr_p.h
Normal file
29
lib/isc/netmgr_p.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <isc/mem.h>
|
||||
#include <isc/result.h>
|
||||
|
||||
void
|
||||
isc__netmgr_create(isc_mem_t *mctx, uint32_t workers, isc_nm_t **netgmrp);
|
||||
/*%<
|
||||
* Creates a new network manager with 'workers' worker threads,
|
||||
* and starts it running.
|
||||
*/
|
||||
|
||||
void
|
||||
isc__netmgr_destroy(isc_nm_t **netmgrp);
|
||||
/*%<
|
||||
* Destroy is working the same way as isc_nm_detach, but it actively waits
|
||||
* for all other references to be gone.
|
||||
*/
|
81
lib/isc/socket_p.h
Normal file
81
lib/isc/socket_p.h
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <isc/mem.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/socket.h>
|
||||
|
||||
isc_result_t
|
||||
isc__socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp,
|
||||
unsigned int maxsocks, int nthreads);
|
||||
/*%<
|
||||
* Create a socket manager. If "maxsocks" is non-zero, it specifies the
|
||||
* maximum number of sockets that the created manager should handle.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*\li All memory will be allocated in memory context 'mctx'.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li 'mctx' is a valid memory context.
|
||||
*
|
||||
*\li 'managerp' points to a NULL isc_socketmgr_t.
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
*\li '*managerp' is a valid isc_socketmgr_t.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
*\li #ISC_R_SUCCESS
|
||||
*\li #ISC_R_NOMEMORY
|
||||
*\li #ISC_R_UNEXPECTED
|
||||
*\li #ISC_R_NOTIMPLEMENTED
|
||||
*/
|
||||
|
||||
void
|
||||
isc__socketmgr_destroy(isc_socketmgr_t **managerp);
|
||||
/*%<
|
||||
* Destroy a socket manager.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*\li This routine blocks until there are no sockets left in the manager,
|
||||
* so if the caller holds any socket references using the manager, it
|
||||
* must detach them before calling isc_socketmgr_destroy() or it will
|
||||
* block forever.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li '*managerp' is a valid isc_socketmgr_t.
|
||||
*
|
||||
*\li All sockets managed by this manager are fully detached.
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
*\li *managerp == NULL
|
||||
*
|
||||
*\li All resources used by the manager have been freed.
|
||||
*/
|
||||
|
||||
#if !WIN32
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
typedef struct isc_socketwait isc_socketwait_t;
|
||||
int
|
||||
isc__socketmgr_waitevents(isc_socketmgr_t *, struct timeval *,
|
||||
isc_socketwait_t **);
|
||||
isc_result_t
|
||||
isc__socketmgr_dispatch(isc_socketmgr_t *, isc_socketwait_t *);
|
||||
|
||||
#endif
|
@ -44,9 +44,7 @@
|
||||
#include <json_object.h>
|
||||
#endif /* HAVE_JSON_C */
|
||||
|
||||
#ifdef OPENSSL_LEAKS
|
||||
#include <openssl/err.h>
|
||||
#endif /* ifdef OPENSSL_LEAKS */
|
||||
#include "task_p.h"
|
||||
|
||||
/*
|
||||
* Task manager is built around 'as little locking as possible' concept.
|
||||
@ -967,8 +965,8 @@ isc_taskmgr_detach(isc_taskmgr_t *manager) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_taskmgr_create(isc_mem_t *mctx, unsigned int default_quantum, isc_nm_t *nm,
|
||||
isc_taskmgr_t **managerp) {
|
||||
isc__taskmgr_create(isc_mem_t *mctx, unsigned int default_quantum, isc_nm_t *nm,
|
||||
isc_taskmgr_t **managerp) {
|
||||
isc_taskmgr_t *manager;
|
||||
|
||||
/*
|
||||
@ -1010,7 +1008,7 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int default_quantum, isc_nm_t *nm,
|
||||
}
|
||||
|
||||
void
|
||||
isc_taskmgr_destroy(isc_taskmgr_t **managerp) {
|
||||
isc__taskmgr_destroy(isc_taskmgr_t **managerp) {
|
||||
isc_taskmgr_t *manager;
|
||||
isc_task_t *task;
|
||||
|
||||
|
86
lib/isc/task_p.h
Normal file
86
lib/isc/task_p.h
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <isc/mem.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/task.h>
|
||||
|
||||
isc_result_t
|
||||
isc__taskmgr_create(isc_mem_t *mctx, unsigned int default_quantum, isc_nm_t *nm,
|
||||
isc_taskmgr_t **managerp);
|
||||
/*%<
|
||||
* Create a new task manager.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*\li If 'default_quantum' is non-zero, then it will be used as the default
|
||||
* quantum value when tasks are created. If zero, then an implementation
|
||||
* defined default quantum will be used.
|
||||
*
|
||||
*\li If 'nm' is set then netmgr is paused when an exclusive task mode
|
||||
* is requested.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li 'mctx' is a valid memory context.
|
||||
*
|
||||
*\li managerp != NULL && *managerp == NULL
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
*\li On success, '*managerp' will be attached to the newly created task
|
||||
* manager.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
*\li #ISC_R_SUCCESS
|
||||
*\li #ISC_R_NOMEMORY
|
||||
*\li #ISC_R_NOTHREADS No threads could be created.
|
||||
*\li #ISC_R_UNEXPECTED An unexpected error occurred.
|
||||
*\li #ISC_R_SHUTTINGDOWN The non-threaded, shared, task
|
||||
* manager shutting down.
|
||||
*/
|
||||
|
||||
void
|
||||
isc__taskmgr_destroy(isc_taskmgr_t **managerp);
|
||||
/*%<
|
||||
* Destroy '*managerp'.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*\li Calling isc_taskmgr_destroy() will shutdown all tasks managed by
|
||||
* *managerp that haven't already been shutdown. The call will block
|
||||
* until all tasks have entered the done state.
|
||||
*
|
||||
*\li isc_taskmgr_destroy() must not be called by a task event action,
|
||||
* because it would block forever waiting for the event action to
|
||||
* complete. An event action that wants to cause task manager shutdown
|
||||
* should request some non-event action thread of execution to do the
|
||||
* shutdown, e.g. by signaling a condition variable or using
|
||||
* isc_app_shutdown().
|
||||
*
|
||||
*\li Task manager references are not reference counted, so the caller
|
||||
* must ensure that no attempt will be made to use the manager after
|
||||
* isc_taskmgr_destroy() returns.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li '*managerp' is a valid task manager.
|
||||
*
|
||||
*\li isc_taskmgr_destroy() has not be called previously on '*managerp'.
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
*\li All resources used by the task manager, and any tasks it managed,
|
||||
* have been freed.
|
||||
*/
|
@ -10,7 +10,7 @@ LDADD += \
|
||||
|
||||
check_LTLIBRARIES = libisctest.la
|
||||
libisctest_la_SOURCES = \
|
||||
../unix/socket_p.h \
|
||||
../socket_p.h \
|
||||
isctest.c \
|
||||
isctest.h \
|
||||
uv_wrap.h
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "../netmgr/netmgr-int.h"
|
||||
#include "../netmgr/uv-compat.c"
|
||||
#include "../netmgr/uv-compat.h"
|
||||
#include "../netmgr_p.h"
|
||||
#include "isctest.h"
|
||||
|
||||
#define MAX_NM 2
|
||||
@ -319,7 +320,7 @@ nm_setup(void **state) {
|
||||
|
||||
nm = isc_mem_get(test_mctx, MAX_NM * sizeof(nm[0]));
|
||||
for (size_t i = 0; i < MAX_NM; i++) {
|
||||
nm[i] = isc_nm_start(test_mctx, nworkers);
|
||||
isc__netmgr_create(test_mctx, nworkers, &nm[i]);
|
||||
assert_non_null(nm[i]);
|
||||
}
|
||||
|
||||
@ -339,7 +340,7 @@ nm_teardown(void **state) {
|
||||
isc_nm_t **nm = (isc_nm_t **)*state;
|
||||
|
||||
for (size_t i = 0; i < MAX_NM; i++) {
|
||||
isc_nm_destroy(&nm[i]);
|
||||
isc__netmgr_destroy(&nm[i]);
|
||||
assert_null(nm[i]);
|
||||
}
|
||||
isc_mem_put(test_mctx, nm, MAX_NM * sizeof(nm[0]));
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/hp.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/os.h>
|
||||
#include <isc/socket.h>
|
||||
@ -58,18 +59,7 @@ cleanup_managers(void) {
|
||||
isc_task_shutdown(maintask);
|
||||
isc_task_destroy(&maintask);
|
||||
}
|
||||
if (socketmgr != NULL) {
|
||||
isc_socketmgr_destroy(&socketmgr);
|
||||
}
|
||||
if (taskmgr != NULL) {
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
}
|
||||
if (netmgr != NULL) {
|
||||
isc_nm_destroy(&netmgr);
|
||||
}
|
||||
if (timermgr != NULL) {
|
||||
isc_timermgr_destroy(&timermgr);
|
||||
}
|
||||
isc_managers_destroy(&netmgr, &taskmgr, &timermgr, &socketmgr);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@ -87,14 +77,12 @@ create_managers(unsigned int workers) {
|
||||
INSIST(workers != 0);
|
||||
|
||||
isc_hp_init(6 * workers);
|
||||
isc_managers_create(test_mctx, workers, 0, 0, &netmgr, &taskmgr,
|
||||
&timermgr, &socketmgr);
|
||||
|
||||
netmgr = isc_nm_start(test_mctx, workers);
|
||||
CHECK(isc_taskmgr_create(test_mctx, 0, netmgr, &taskmgr));
|
||||
CHECK(isc_task_create(taskmgr, 0, &maintask));
|
||||
isc_taskmgr_setexcltask(taskmgr, maintask);
|
||||
|
||||
CHECK(isc_timermgr_create(test_mctx, &timermgr));
|
||||
CHECK(isc_socketmgr_create(test_mctx, &socketmgr));
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
@ -150,9 +138,6 @@ isc_test_end(void) {
|
||||
if (maintask != NULL) {
|
||||
isc_task_detach(&maintask);
|
||||
}
|
||||
if (taskmgr != NULL) {
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
}
|
||||
|
||||
cleanup_managers();
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "../netmgr/udp.c"
|
||||
#include "../netmgr/uv-compat.c"
|
||||
#include "../netmgr/uv-compat.h"
|
||||
#include "../netmgr_p.h"
|
||||
#include "isctest.h"
|
||||
|
||||
typedef void (*stream_connect_function)(isc_nm_t *nm);
|
||||
@ -335,12 +336,12 @@ nm_setup(void **state __attribute__((unused))) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
listen_nm = isc_nm_start(test_mctx, workers);
|
||||
isc__netmgr_create(test_mctx, workers, &listen_nm);
|
||||
assert_non_null(listen_nm);
|
||||
isc_nm_settimeouts(listen_nm, T_INIT, T_IDLE, T_KEEPALIVE,
|
||||
T_ADVERTISED);
|
||||
|
||||
connect_nm = isc_nm_start(test_mctx, workers);
|
||||
isc__netmgr_create(test_mctx, workers, &connect_nm);
|
||||
assert_non_null(connect_nm);
|
||||
isc_nm_settimeouts(connect_nm, T_INIT, T_IDLE, T_KEEPALIVE,
|
||||
T_ADVERTISED);
|
||||
@ -358,10 +359,10 @@ static int
|
||||
nm_teardown(void **state __attribute__((unused))) {
|
||||
UNUSED(state);
|
||||
|
||||
isc_nm_destroy(&connect_nm);
|
||||
isc__netmgr_destroy(&connect_nm);
|
||||
assert_null(connect_nm);
|
||||
|
||||
isc_nm_destroy(&listen_nm);
|
||||
isc__netmgr_destroy(&listen_nm);
|
||||
assert_null(listen_nm);
|
||||
|
||||
WAIT_FOR_EQ(active_cconnects, 0);
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <isc/socket.h>
|
||||
#include <isc/task.h>
|
||||
|
||||
#include "../unix/socket_p.h"
|
||||
#include "../socket_p.h"
|
||||
#include "isctest.h"
|
||||
|
||||
static bool recv_dscp;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <isc/cmocka.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/condition.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/platform.h>
|
||||
#include <isc/print.h>
|
||||
@ -784,7 +785,6 @@ maxtask_cb(isc_task_t *task, isc_event_t *event) {
|
||||
static void
|
||||
manytasks(void **state) {
|
||||
isc_mem_t *mctx = NULL;
|
||||
isc_result_t result;
|
||||
isc_event_t *event = NULL;
|
||||
uintptr_t ntasks = 10000;
|
||||
|
||||
@ -801,9 +801,7 @@ manytasks(void **state) {
|
||||
isc_mem_debugging = ISC_MEM_DEBUGRECORD;
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
netmgr = isc_nm_start(mctx, 4);
|
||||
result = isc_taskmgr_create(mctx, 0, netmgr, &taskmgr);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
isc_managers_create(mctx, 4, 0, 0, &netmgr, &taskmgr, NULL, NULL);
|
||||
|
||||
atomic_init(&done, false);
|
||||
|
||||
@ -818,8 +816,8 @@ manytasks(void **state) {
|
||||
}
|
||||
UNLOCK(&lock);
|
||||
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
isc_nm_destroy(&netmgr);
|
||||
isc_managers_destroy(&netmgr, &taskmgr, NULL, NULL);
|
||||
|
||||
isc_mem_destroy(&mctx);
|
||||
isc_condition_destroy(&cv);
|
||||
isc_mutex_destroy(&lock);
|
||||
@ -899,7 +897,7 @@ sd_event2(isc_task_t *task, isc_event_t *event) {
|
||||
}
|
||||
|
||||
static void
|
||||
shutdown(void **state) {
|
||||
task_shutdown(void **state) {
|
||||
isc_result_t result;
|
||||
isc_eventtype_t event_type;
|
||||
isc_event_t *event = NULL;
|
||||
@ -1545,7 +1543,8 @@ main(int argc, char **argv) {
|
||||
cmocka_unit_test_setup_teardown(purgeevent_notpurge, _setup,
|
||||
_teardown),
|
||||
cmocka_unit_test_setup_teardown(purgerange, _setup, _teardown),
|
||||
cmocka_unit_test_setup_teardown(shutdown, _setup4, _teardown),
|
||||
cmocka_unit_test_setup_teardown(task_shutdown, _setup4,
|
||||
_teardown),
|
||||
cmocka_unit_test_setup_teardown(task_exclusive, _setup4,
|
||||
_teardown),
|
||||
};
|
||||
|
@ -29,9 +29,7 @@
|
||||
#include <isc/timer.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#ifdef OPENSSL_LEAKS
|
||||
#include <openssl/err.h>
|
||||
#endif /* ifdef OPENSSL_LEAKS */
|
||||
#include "timer_p.h"
|
||||
|
||||
#ifdef ISC_TIMER_TRACE
|
||||
#define XTRACE(s) fprintf(stderr, "%s\n", (s))
|
||||
@ -630,10 +628,6 @@ static isc_threadresult_t
|
||||
}
|
||||
UNLOCK(&manager->lock);
|
||||
|
||||
#ifdef OPENSSL_LEAKS
|
||||
ERR_remove_state(0);
|
||||
#endif /* ifdef OPENSSL_LEAKS */
|
||||
|
||||
return ((isc_threadresult_t)0);
|
||||
}
|
||||
|
||||
@ -663,7 +657,7 @@ set_index(void *what, unsigned int index) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
|
||||
isc__timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
|
||||
isc_timermgr_t *manager;
|
||||
isc_result_t result;
|
||||
|
||||
@ -707,7 +701,7 @@ isc_timermgr_poke(isc_timermgr_t *manager) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_timermgr_destroy(isc_timermgr_t **managerp) {
|
||||
isc__timermgr_destroy(isc_timermgr_t **managerp) {
|
||||
isc_timermgr_t *manager;
|
||||
|
||||
/*
|
||||
|
65
lib/isc/timer_p.h
Normal file
65
lib/isc/timer_p.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <isc/mem.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/timer.h>
|
||||
|
||||
isc_result_t
|
||||
isc__timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp);
|
||||
/*%<
|
||||
* Create a timer manager.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*\li All memory will be allocated in memory context 'mctx'.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li 'mctx' is a valid memory context.
|
||||
*
|
||||
*\li 'managerp' points to a NULL isc_timermgr_t.
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
*\li '*managerp' is a valid isc_timermgr_t.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
*\li Success
|
||||
*\li No memory
|
||||
*\li Unexpected error
|
||||
*/
|
||||
|
||||
void
|
||||
isc__timermgr_destroy(isc_timermgr_t **managerp);
|
||||
/*%<
|
||||
* Destroy a timer manager.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*\li This routine blocks until there are no timers left in the manager,
|
||||
* so if the caller holds any timer references using the manager, it
|
||||
* must detach them before calling isc_timermgr_destroy() or it will
|
||||
* block forever.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li '*managerp' is a valid isc_timermgr_t.
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
*\li *managerp == NULL
|
||||
*
|
||||
*\li All resources used by the manager have been freed.
|
||||
*/
|
@ -74,6 +74,7 @@
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#include "errno2result.h"
|
||||
#include "socket_p.h"
|
||||
|
||||
#ifdef ENABLE_TCP_FASTOPEN
|
||||
#include <netinet/tcp.h>
|
||||
@ -3752,12 +3753,7 @@ cleanup_thread(isc_mem_t *mctx, isc__socketthread_t *thread) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
return (isc_socketmgr_create2(mctx, managerp, 0, 1));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp,
|
||||
isc__socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp,
|
||||
unsigned int maxsocks, int nthreads) {
|
||||
int i;
|
||||
isc_socketmgr_t *manager;
|
||||
@ -3828,7 +3824,7 @@ isc_socketmgr_setstats(isc_socketmgr_t *manager, isc_stats_t *stats) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
|
||||
isc__socketmgr_destroy(isc_socketmgr_t **managerp) {
|
||||
isc_socketmgr_t *manager;
|
||||
|
||||
/*
|
||||
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#ifndef ISC_SOCKET_P_H
|
||||
#define ISC_SOCKET_P_H
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
typedef struct isc_socketwait isc_socketwait_t;
|
||||
int
|
||||
isc__socketmgr_waitevents(isc_socketmgr_t *, struct timeval *,
|
||||
isc_socketwait_t **);
|
||||
isc_result_t
|
||||
isc__socketmgr_dispatch(isc_socketmgr_t *, isc_socketwait_t *);
|
||||
#endif /* ISC_SOCKET_P_H */
|
@ -96,9 +96,6 @@ isc_socket_send
|
||||
isc_socket_sendto
|
||||
isc_socket_sendto2
|
||||
isc_socket_setname
|
||||
isc_socketmgr_create
|
||||
isc_socketmgr_create2
|
||||
isc_socketmgr_destroy
|
||||
isc_socketmgr_getmaxsockets
|
||||
isc_socketmgr_setreserved
|
||||
isc_socketmgr_setstats
|
||||
@ -352,6 +349,8 @@ isc_logconfig_create
|
||||
isc_logconfig_destroy
|
||||
isc_logconfig_use
|
||||
isc_logfile_roll
|
||||
isc_managers_create
|
||||
isc_managers_destroy
|
||||
isc_md_new
|
||||
isc_md_init
|
||||
isc_md_reset
|
||||
@ -453,7 +452,6 @@ isc_nmhandle_setdata
|
||||
isc_nmhandle_settimeout
|
||||
isc_nm_cancelread
|
||||
isc_nm_closedown
|
||||
isc_nm_destroy
|
||||
isc_nm_detach
|
||||
isc_nm_http_endpoint
|
||||
isc_nm_httpconnect
|
||||
@ -469,7 +467,6 @@ isc_nm_read
|
||||
isc_nm_resumeread
|
||||
isc_nm_send
|
||||
isc_nm_setstats
|
||||
isc_nm_start
|
||||
isc_nm_stoplistening
|
||||
isc_nm_tcpconnect
|
||||
isc_nm_tcpdnsconnect
|
||||
@ -653,8 +650,6 @@ isc_task_setprivilege
|
||||
isc_task_shutdown
|
||||
isc_task_unpause
|
||||
isc_task_unsend
|
||||
isc_taskmgr_create
|
||||
isc_taskmgr_destroy
|
||||
isc_taskmgr_excltask
|
||||
@IF NOTYET
|
||||
isc_taskmgr_renderjson
|
||||
@ -706,8 +701,6 @@ isc_timer_detach
|
||||
isc_timer_gettype
|
||||
isc_timer_reset
|
||||
isc_timer_touch
|
||||
isc_timermgr_create
|
||||
isc_timermgr_destroy
|
||||
isc_timermgr_poke
|
||||
isc_tls_get_http2_alpn
|
||||
isc_tls_create
|
||||
|
@ -140,6 +140,9 @@
|
||||
<ClInclude Include="..\include\isc\magic.h">
|
||||
<Filter>Library Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\isc\managers.h">
|
||||
<Filter>Library Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\isc\mem.h">
|
||||
<Filter>Library Header Files</Filter>
|
||||
</ClInclude>
|
||||
@ -530,6 +533,9 @@
|
||||
<ClCompile Include="..\log.c">
|
||||
<Filter>Library Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\managers.c">
|
||||
<Filter>Library Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\mem.c">
|
||||
<Filter>Library Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -302,6 +302,7 @@ copy InstallFiles ..\Build\Release\
|
||||
<ClInclude Include="..\include\isc\list.h" />
|
||||
<ClInclude Include="..\include\isc\log.h" />
|
||||
<ClInclude Include="..\include\isc\magic.h" />
|
||||
<ClInclude Include="..\include\isc\managers.h" />
|
||||
<ClInclude Include="..\include\isc\md.h" />
|
||||
<ClInclude Include="..\include\isc\mem.h" />
|
||||
<ClInclude Include="..\include\isc\meminfo.h" />
|
||||
@ -412,6 +413,7 @@ copy InstallFiles ..\Build\Release\
|
||||
<ClCompile Include="..\lex.c" />
|
||||
<ClCompile Include="..\lib.c" />
|
||||
<ClCompile Include="..\log.c" />
|
||||
<ClCompile Include="..\managers.c" />
|
||||
<ClCompile Include="..\md.c" />
|
||||
<ClCompile Include="..\mem.c" />
|
||||
<ClCompile Include="..\mutexblock.c" />
|
||||
|
@ -82,6 +82,7 @@
|
||||
#endif /* HAVE_LIBXML2 */
|
||||
|
||||
#include "errno2result.h"
|
||||
#include "socket_p.h"
|
||||
|
||||
/*
|
||||
* Set by the -T dscp option on the command line. If set to a value
|
||||
@ -2548,12 +2549,7 @@ SocketIoThread(LPVOID ThreadContext) {
|
||||
* Create a new socket manager.
|
||||
*/
|
||||
isc_result_t
|
||||
isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
return (isc_socketmgr_create2(mctx, managerp, 0, 1));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp,
|
||||
isc__socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp,
|
||||
unsigned int maxsocks, int nthreads) {
|
||||
isc_socketmgr_t *manager;
|
||||
|
||||
@ -2611,7 +2607,7 @@ isc_socketmgr_setstats(isc_socketmgr_t *manager, isc_stats_t *stats) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
|
||||
isc__socketmgr_destroy(isc_socketmgr_t **managerp) {
|
||||
isc_socketmgr_t *manager;
|
||||
|
||||
/*
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/file.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/managers.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/netmgr.h>
|
||||
#include <isc/os.h>
|
||||
@ -56,7 +57,6 @@ isc_taskmgr_t *taskmgr = NULL;
|
||||
isc_task_t *maintask = NULL;
|
||||
isc_timermgr_t *timermgr = NULL;
|
||||
isc_socketmgr_t *socketmgr = NULL;
|
||||
isc_nm_t *nm = NULL;
|
||||
dns_zonemgr_t *zonemgr = NULL;
|
||||
dns_dispatchmgr_t *dispatchmgr = NULL;
|
||||
ns_clientmgr_t *clientmgr = NULL;
|
||||
@ -198,28 +198,9 @@ cleanup_managers(void) {
|
||||
if (interfacemgr != NULL) {
|
||||
ns_interfacemgr_detach(&interfacemgr);
|
||||
}
|
||||
if (socketmgr != NULL) {
|
||||
isc_socketmgr_destroy(&socketmgr);
|
||||
}
|
||||
ns_test_nap(500000);
|
||||
if (nm != NULL) {
|
||||
/*
|
||||
* Force something in the workqueue as a workaround
|
||||
* for libuv bug - not sending uv_close callback.
|
||||
*/
|
||||
isc_nm_pause(nm);
|
||||
isc_nm_resume(nm);
|
||||
isc_nm_detach(&nm);
|
||||
}
|
||||
if (taskmgr != NULL) {
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
}
|
||||
if (netmgr != NULL) {
|
||||
isc_nm_destroy(&netmgr);
|
||||
}
|
||||
if (timermgr != NULL) {
|
||||
isc_timermgr_destroy(&timermgr);
|
||||
}
|
||||
|
||||
isc_managers_destroy(&netmgr, &taskmgr, &timermgr, &socketmgr);
|
||||
|
||||
if (app_running) {
|
||||
isc_app_finish();
|
||||
}
|
||||
@ -241,24 +222,18 @@ create_managers(void) {
|
||||
isc_event_t *event = NULL;
|
||||
ncpus = isc_os_ncpus();
|
||||
|
||||
netmgr = isc_nm_start(mctx, ncpus);
|
||||
CHECK(isc_taskmgr_create(mctx, 0, netmgr, &taskmgr));
|
||||
isc_managers_create(mctx, ncpus, 0, 0, &netmgr, &taskmgr, &timermgr,
|
||||
&socketmgr);
|
||||
CHECK(isc_task_create(taskmgr, 0, &maintask));
|
||||
isc_taskmgr_setexcltask(taskmgr, maintask);
|
||||
CHECK(isc_task_onshutdown(maintask, shutdown_managers, NULL));
|
||||
|
||||
CHECK(isc_timermgr_create(mctx, &timermgr));
|
||||
|
||||
CHECK(isc_socketmgr_create(mctx, &socketmgr));
|
||||
|
||||
nm = isc_nm_start(mctx, ncpus);
|
||||
|
||||
CHECK(ns_server_create(mctx, matchview, &sctx));
|
||||
|
||||
CHECK(dns_dispatchmgr_create(mctx, &dispatchmgr));
|
||||
|
||||
CHECK(ns_interfacemgr_create(mctx, sctx, taskmgr, timermgr, socketmgr,
|
||||
nm, dispatchmgr, maintask, ncpus, NULL,
|
||||
netmgr, dispatchmgr, maintask, ncpus, NULL,
|
||||
ncpus, &interfacemgr));
|
||||
|
||||
CHECK(ns_listenlist_default(mctx, port, -1, true, &listenon));
|
||||
|
@ -1887,6 +1887,7 @@
|
||||
./lib/isc/include/isc/list.h C 1997,1998,1999,2000,2001,2002,2004,2006,2007,2011,2012,2013,2016,2018,2019,2020,2021
|
||||
./lib/isc/include/isc/log.h C 1999,2000,2001,2002,2004,2005,2006,2007,2009,2014,2016,2017,2018,2019,2020,2021
|
||||
./lib/isc/include/isc/magic.h C 1999,2000,2001,2004,2005,2006,2007,2016,2017,2018,2019,2020,2021
|
||||
./lib/isc/include/isc/managers.h C 2021
|
||||
./lib/isc/include/isc/md.h C 2018,2019,2020,2021
|
||||
./lib/isc/include/isc/mem.h C 1997,1998,1999,2000,2001,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2015,2016,2017,2018,2019,2020,2021
|
||||
./lib/isc/include/isc/meminfo.h C 2015,2016,2018,2019,2020,2021
|
||||
@ -1944,6 +1945,7 @@
|
||||
./lib/isc/lib.c C 1999,2000,2001,2004,2005,2007,2009,2013,2014,2015,2016,2018,2019,2020,2021
|
||||
./lib/isc/lib_p.h C 2021
|
||||
./lib/isc/log.c C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2009,2011,2012,2013,2014,2016,2017,2018,2019,2020,2021
|
||||
./lib/isc/managers.c C 2021
|
||||
./lib/isc/md.c C 2018,2019,2020,2021
|
||||
./lib/isc/mem.c C 1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021
|
||||
./lib/isc/mem_p.h C 2018,2019,2020,2021
|
||||
@ -1960,6 +1962,7 @@
|
||||
./lib/isc/netmgr/uv-compat.c C 2020,2021
|
||||
./lib/isc/netmgr/uv-compat.h C 2019,2020,2021
|
||||
./lib/isc/netmgr/uverr2result.c C 2019,2020,2021
|
||||
./lib/isc/netmgr_p.h C 2021
|
||||
./lib/isc/netscope.c C 2002,2004,2005,2006,2007,2016,2018,2019,2020,2021
|
||||
./lib/isc/nonce.c C 2018,2019,2020,2021
|
||||
./lib/isc/openssl_shim.c C 2018,2019,2020,2021
|
||||
@ -1989,10 +1992,12 @@
|
||||
./lib/isc/serial.c C 1999,2000,2001,2004,2005,2007,2016,2018,2019,2020,2021
|
||||
./lib/isc/siphash.c C 2019,2020,2021
|
||||
./lib/isc/sockaddr.c C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2010,2011,2012,2014,2015,2016,2017,2018,2019,2020,2021
|
||||
./lib/isc/socket_p.h C 2021
|
||||
./lib/isc/stats.c C 2009,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021
|
||||
./lib/isc/string.c C 1999,2000,2001,2003,2004,2005,2006,2007,2011,2012,2014,2015,2016,2018,2019,2020,2021
|
||||
./lib/isc/symtab.c C 1996,1997,1998,1999,2000,2001,2004,2005,2007,2011,2012,2013,2016,2018,2019,2020,2021
|
||||
./lib/isc/task.c C 1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021
|
||||
./lib/isc/task_p.h C 2021
|
||||
./lib/isc/taskpool.c C 1999,2000,2001,2004,2005,2007,2011,2012,2013,2016,2018,2019,2020,2021
|
||||
./lib/isc/tests/aes_test.c C 2014,2016,2018,2019,2020,2021
|
||||
./lib/isc/tests/buffer_test.c C 2014,2015,2016,2017,2018,2019,2020,2021
|
||||
@ -2031,6 +2036,7 @@
|
||||
./lib/isc/tests/timer_test.c C 2018,2019,2020,2021
|
||||
./lib/isc/tests/uv_wrap.h C 2020,2021
|
||||
./lib/isc/timer.c C 1998,1999,2000,2001,2002,2004,2005,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021
|
||||
./lib/isc/timer_p.h C 2021
|
||||
./lib/isc/tls.c C 2021
|
||||
./lib/isc/tls_p.h C 2021
|
||||
./lib/isc/tm.c C 2014,2016,2018,2019,2020,2021
|
||||
@ -2059,7 +2065,6 @@
|
||||
./lib/isc/unix/pk11_api.c C 2014,2016,2018,2019,2020,2021
|
||||
./lib/isc/unix/resource.c C 2000,2001,2004,2007,2008,2009,2016,2018,2019,2020,2021
|
||||
./lib/isc/unix/socket.c C 1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021
|
||||
./lib/isc/unix/socket_p.h C 2000,2001,2004,2005,2007,2008,2009,2016,2018,2019,2020,2021
|
||||
./lib/isc/unix/stdio.c C 2000,2001,2004,2007,2011,2012,2013,2014,2016,2018,2019,2020,2021
|
||||
./lib/isc/unix/stdtime.c C 1999,2000,2001,2004,2005,2007,2016,2018,2019,2020,2021
|
||||
./lib/isc/unix/syslog.c C 2001,2004,2005,2007,2016,2018,2019,2020,2021
|
||||
|
Loading…
x
Reference in New Issue
Block a user