From 544e88a0b8891f8e1c6a2f2f079b622617fe9298 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Fri, 8 Feb 2019 17:15:39 +0200 Subject: [PATCH] MXS-2314 Remove unnecessary monitor state --- include/maxscale/monitor.hh | 3 +-- server/core/monitor.cc | 6 +----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/include/maxscale/monitor.hh b/include/maxscale/monitor.hh index 36a734607..22552d499 100644 --- a/include/maxscale/monitor.hh +++ b/include/maxscale/monitor.hh @@ -81,9 +81,8 @@ enum monitor_capability_t // Monitor state enum enum monitor_state_t { + MONITOR_STATE_STOPPED, MONITOR_STATE_RUNNING, - MONITOR_STATE_STOPPING, - MONITOR_STATE_STOPPED }; /* Return type of mon_ping_or_connect_to_db(). */ diff --git a/server/core/monitor.cc b/server/core/monitor.cc index cf9ec5811..9379c1621 100644 --- a/server/core/monitor.cc +++ b/server/core/monitor.cc @@ -320,7 +320,6 @@ void monitor_stop(Monitor* monitor) /** Only stop the monitor if it is running */ if (monitor->m_state == MONITOR_STATE_RUNNING) { - monitor->m_state = MONITOR_STATE_STOPPING; monitor->stop(); monitor->m_state = MONITOR_STATE_STOPPED; } @@ -1612,9 +1611,6 @@ static const char* monitor_state_to_string(monitor_state_t state) case MONITOR_STATE_RUNNING: return "Running"; - case MONITOR_STATE_STOPPING: - return "Stopping"; - case MONITOR_STATE_STOPPED: return "Stopped"; @@ -2489,7 +2485,7 @@ void MonitorWorker::do_stop() mxb_assert(mxs_rworker_get_current() == NULL || mxs_rworker_get_current() == mxs_rworker_get(MXS_RWORKER_MAIN)); mxb_assert(Worker::state() != Worker::STOPPED); - mxb_assert(monitor_state() == MONITOR_STATE_STOPPING); + mxb_assert(monitor_state() != MONITOR_STATE_STOPPED); mxb_assert(m_thread_running.load() == true); Worker::shutdown();