Commit a011d422 authored by Ondřej Surý's avatar Ondřej Surý Committed by Evan Hunt
Browse files

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.
parent f23afce6
......@@ -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_taskmgr_create(named_g_mctx, 0, named_g_nm,
&named_g_taskmgr);
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) {
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);
return (result);
}
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;