mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
make sure zone manager is not destroyed until tasks have finished
This commit is contained in:
@@ -633,16 +633,6 @@ run_server(isc_task_t *task, isc_event_t *event) {
|
|||||||
|
|
||||||
isc_event_free(&event);
|
isc_event_free(&event);
|
||||||
|
|
||||||
result = dns_zonemgr_create(ns_g_mctx, ns_g_taskmgr, ns_g_timermgr,
|
|
||||||
ns_g_socketmgr, &ns_g_server->zonemgr);
|
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
|
||||||
"ns_zoneemgr_create() failed: %s",
|
|
||||||
isc_result_totext(result));
|
|
||||||
/* XXX cleanup */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = ns_clientmgr_create(ns_g_mctx, ns_g_taskmgr, ns_g_timermgr,
|
result = ns_clientmgr_create(ns_g_mctx, ns_g_taskmgr, ns_g_timermgr,
|
||||||
&server->clientmgr);
|
&server->clientmgr);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
@@ -698,8 +688,8 @@ shutdown_server(isc_task_t *task, isc_event_t *event) {
|
|||||||
ns_clientmgr_destroy(&server->clientmgr);
|
ns_clientmgr_destroy(&server->clientmgr);
|
||||||
ns_interfacemgr_shutdown(server->interfacemgr);
|
ns_interfacemgr_shutdown(server->interfacemgr);
|
||||||
ns_interfacemgr_detach(&server->interfacemgr);
|
ns_interfacemgr_detach(&server->interfacemgr);
|
||||||
dns_zonemgr_destroy(&server->zonemgr);
|
dns_zonemgr_shutdown(server->zonemgr);
|
||||||
|
|
||||||
isc_task_detach(&server->task);
|
isc_task_detach(&server->task);
|
||||||
|
|
||||||
isc_event_free(&event);
|
isc_event_free(&event);
|
||||||
@@ -757,6 +747,16 @@ ns_server_create(isc_mem_t *mctx, ns_server_t **serverp) {
|
|||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
goto cleanup_task;
|
goto cleanup_task;
|
||||||
|
|
||||||
|
result = dns_zonemgr_create(ns_g_mctx, ns_g_taskmgr, ns_g_timermgr,
|
||||||
|
ns_g_socketmgr, &server->zonemgr);
|
||||||
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||||
|
"ns_zonemgr_create() failed: %s",
|
||||||
|
isc_result_totext(result));
|
||||||
|
/* XXX cleanup */
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
server->magic = NS_SERVER_MAGIC;
|
server->magic = NS_SERVER_MAGIC;
|
||||||
*serverp = server;
|
*serverp = server;
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
@@ -775,6 +775,9 @@ ns_server_destroy(ns_server_t **serverp) {
|
|||||||
|
|
||||||
INSIST(ISC_LIST_EMPTY(server->viewlist));
|
INSIST(ISC_LIST_EMPTY(server->viewlist));
|
||||||
|
|
||||||
|
dns_zonemgr_destroy(&server->zonemgr);
|
||||||
|
server->zonemgr = NULL;
|
||||||
|
|
||||||
dns_db_detach(&server->roothints);
|
dns_db_detach(&server->roothints);
|
||||||
|
|
||||||
isc_rwlock_destroy(&server->viewlock);
|
isc_rwlock_destroy(&server->viewlock);
|
||||||
|
Reference in New Issue
Block a user