/* Do not flush master files */
named_server_flushonshutdown(named_g_server, false);
named_os_shutdownmsg(cmdline, *text);
- isc_app_shutdown();
- result = ISC_R_SUCCESS;
+ result = ISC_R_SHUTTINGDOWN;
} else if (command_compare(command, NAMED_COMMAND_STOP)) {
/*
* "stop" is the same as "halt" except it does
#endif /* ifdef HAVE_LIBSCF */
named_server_flushonshutdown(named_g_server, true);
named_os_shutdownmsg(cmdline, *text);
- isc_app_shutdown();
- result = ISC_R_SUCCESS;
+ result = ISC_R_SHUTTINGDOWN;
} else if (command_compare(command, NAMED_COMMAND_ADDZONE) ||
command_compare(command, NAMED_COMMAND_MODZONE))
{
#include <inttypes.h>
#include <stdbool.h>
+#include <isc/app.h>
#include <isc/base64.h>
#include <isc/buffer.h>
#include <isc/event.h>
conn->sending = false;
+ if (conn->result == ISC_R_SHUTTINGDOWN) {
+ isc_app_shutdown();
+ goto cleanup_sendhandle;
+ }
+
if (atomic_load_acquire(&listener->controls->shuttingdown) ||
result == ISC_R_CANCELED)
{
}
static void
-control_respond(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
- controlconnection_t *conn = (controlconnection_t *)arg;
+control_respond(isc_nmhandle_t *handle, controlconnection_t *conn) {
controllistener_t *listener = conn->listener;
isccc_sexpr_t *data = NULL;
isc_buffer_t b;
isc_region_t r;
+ isc_result_t result;
result = isccc_cc_createresponse(conn->request, conn->now,
conn->now + 60, &conn->response);
goto cleanup;
}
+ if (conn->result == ISC_R_SHUTTINGDOWN) {
+ result = ISC_R_SUCCESS;
+ } else {
+ result = conn->result;
+ }
+
data = isccc_alist_lookup(conn->response, "_data");
if (data != NULL) {
- if (isccc_cc_defineuint32(data, "result", conn->result) == NULL)
- {
+ if (isccc_cc_defineuint32(data, "result", result) == NULL) {
goto cleanup;
}
}
- if (conn->result != ISC_R_SUCCESS) {
+ if (result != ISC_R_SUCCESS) {
if (data != NULL) {
- const char *estr = isc_result_totext(conn->result);
+ const char *estr = isc_result_totext(result);
if (isccc_cc_definestring(data, "err", estr) == NULL) {
goto cleanup;
}
conn->result = named_control_docommand(conn->request,
listener->readonly, &conn->text);
- control_respond(conn->cmdhandle, conn->result, conn);
+ control_respond(conn->cmdhandle, conn);
done:
isc_event_free(&event);
isc_nonce_buf(&conn->nonce, sizeof(conn->nonce));
}
conn->result = ISC_R_SUCCESS;
- control_respond(handle, result, conn);
+ control_respond(handle, conn);
return;
}