Commit e9a1cabe authored by Petr Menšík's avatar Petr Menšík Committed by Petr Menšík

Delay kserver cleanup until all tasks finishes

It might be possible some pending task would run when kserver is already
cleaned up. Postpone gsstsig structures cleanup after task and timer
managers are destroyed. No pending threads are possible after it.

Make action in maybeshutdown only if doshutdown was not already called.
Might be called from getinput event.
parent 8e74974c
......@@ -749,6 +749,10 @@ doshutdown(void) {
static void
maybeshutdown(void) {
/* when called from getinput, doshutdown might be already finished */
if (!requestmgr)
return;
ddebug("Shutting down request manager");
dns_requestmgr_shutdown(requestmgr);
......@@ -3020,6 +3024,8 @@ send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
isc_sockaddr_t *srcaddr;
debug("send_gssrequest");
REQUIRE(destaddr != NULL);
reqinfo = isc_mem_get(gmctx, sizeof(nsu_gssinfo_t));
reqinfo->msg = msg;
reqinfo->addr = destaddr;
......@@ -3307,20 +3313,6 @@ cleanup(void) {
ddebug("Detaching GSS-TSIG keyring");
dns_tsigkeyring_detach(&gssring);
}
if (kserver != NULL) {
isc_mem_put(gmctx, kserver, sizeof(isc_sockaddr_t));
kserver = NULL;
}
if (realm != NULL) {
isc_mem_free(gmctx, realm);
realm = NULL;
}
if (dns_name_dynamic(&tmpzonename)) {
dns_name_free(&tmpzonename, gmctx);
}
if (dns_name_dynamic(&restart_master)) {
dns_name_free(&restart_master, gmctx);
}
#endif /* ifdef GSSAPI */
if (sig0key != NULL) {
......@@ -3339,6 +3331,23 @@ cleanup(void) {
ddebug("Shutting down timer manager");
isc_timermgr_destroy(&timermgr);
#ifdef GSSAPI
if (kserver != NULL) {
isc_mem_put(gmctx, kserver, sizeof(isc_sockaddr_t));
kserver = NULL;
}
if (realm != NULL) {
isc_mem_free(gmctx, realm);
realm = NULL;
}
if (dns_name_dynamic(&tmpzonename)) {
dns_name_free(&tmpzonename, gmctx);
}
if (dns_name_dynamic(&restart_master)) {
dns_name_free(&restart_master, gmctx);
}
#endif /* ifdef GSSAPI */
ddebug("Removing log context");
isc_log_destroy(&glctx);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment