diff --git a/server/core/admin.cc b/server/core/admin.cc index 266226b5c..58396473a 100644 --- a/server/core/admin.cc +++ b/server/core/admin.cc @@ -410,6 +410,7 @@ bool mxs_admin_init() void mxs_admin_shutdown() { MHD_stop_daemon(http_daemon); + MXS_NOTICE("Stopped MaxScale REST API"); } bool mxs_admin_https_enabled() diff --git a/server/core/gateway.cc b/server/core/gateway.cc index 91da2c46d..aaf22e581 100644 --- a/server/core/gateway.cc +++ b/server/core/gateway.cc @@ -2293,9 +2293,6 @@ int main(int argc, char **argv) /*< Stop all the monitors */ monitorStopAll(); - /** Stop administrative interface */ - mxs_admin_shutdown(); - /*< Stop all the monitors */ monitorStopAll(); @@ -2380,6 +2377,19 @@ return_main: return rc; } /*< End of main */ +class ShutdownTask: public Worker::DisposableTask +{ +public: + void execute(mxs::Worker& w) + { + mxs_admin_shutdown(); + service_shutdown(); + Worker::shutdown_all(); + hkshutdown(); + log_flush_shutdown(); + } +}; + /*< * Shutdown MaxScale server */ @@ -2391,10 +2401,8 @@ int maxscale_shutdown() if (n == 0) { - service_shutdown(); - Worker::shutdown_all(); - hkshutdown(); - log_flush_shutdown(); + mxs::Worker* worker = Worker::get(0); + worker->post(std::auto_ptr(new ShutdownTask), mxs::Worker::EXECUTE_QUEUED); } return n + 1;