MXS-2314 Do not accept NULL when starting/stopping monitor
This commit is contained in:
@ -254,8 +254,8 @@ void MonitorManager::destroy_all_monitors()
|
|||||||
*/
|
*/
|
||||||
void MonitorManager::monitor_start(Monitor* monitor, const MXS_CONFIG_PARAMETER* params)
|
void MonitorManager::monitor_start(Monitor* monitor, const MXS_CONFIG_PARAMETER* params)
|
||||||
{
|
{
|
||||||
if (monitor)
|
mxb_assert(monitor);
|
||||||
{
|
|
||||||
Guard guard(monitor->m_lock);
|
Guard guard(monitor->m_lock);
|
||||||
|
|
||||||
// Only start the monitor if it's stopped.
|
// Only start the monitor if it's stopped.
|
||||||
@ -271,7 +271,6 @@ void MonitorManager::monitor_start(Monitor* monitor, const MXS_CONFIG_PARAMETER*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void MonitorManager::populate_services()
|
void MonitorManager::populate_services()
|
||||||
{
|
{
|
||||||
@ -302,8 +301,8 @@ void monitor_start_all()
|
|||||||
*/
|
*/
|
||||||
void monitor_stop(Monitor* monitor)
|
void monitor_stop(Monitor* monitor)
|
||||||
{
|
{
|
||||||
if (monitor)
|
mxb_assert(monitor);
|
||||||
{
|
|
||||||
Guard guard(monitor->m_lock);
|
Guard guard(monitor->m_lock);
|
||||||
|
|
||||||
/** Only stop the monitor if it is running */
|
/** Only stop the monitor if it is running */
|
||||||
@ -321,7 +320,6 @@ void monitor_stop(Monitor* monitor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void monitor_deactivate(Monitor* monitor)
|
void monitor_deactivate(Monitor* monitor)
|
||||||
{
|
{
|
||||||
|
@ -260,14 +260,20 @@ private:
|
|||||||
HttpResponse cb_stop_monitor(const HttpRequest& request)
|
HttpResponse cb_stop_monitor(const HttpRequest& request)
|
||||||
{
|
{
|
||||||
Monitor* monitor = monitor_find(request.uri_part(1).c_str());
|
Monitor* monitor = monitor_find(request.uri_part(1).c_str());
|
||||||
|
if (monitor)
|
||||||
|
{
|
||||||
monitor_stop(monitor);
|
monitor_stop(monitor);
|
||||||
|
}
|
||||||
return HttpResponse(MHD_HTTP_NO_CONTENT);
|
return HttpResponse(MHD_HTTP_NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpResponse cb_start_monitor(const HttpRequest& request)
|
HttpResponse cb_start_monitor(const HttpRequest& request)
|
||||||
{
|
{
|
||||||
Monitor* monitor = monitor_find(request.uri_part(1).c_str());
|
Monitor* monitor = monitor_find(request.uri_part(1).c_str());
|
||||||
|
if (monitor)
|
||||||
|
{
|
||||||
MonitorManager::monitor_start(monitor, monitor->parameters);
|
MonitorManager::monitor_start(monitor, monitor->parameters);
|
||||||
|
}
|
||||||
return HttpResponse(MHD_HTTP_NO_CONTENT);
|
return HttpResponse(MHD_HTTP_NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user