Allow NULL parameters for start/stop functions
The functions that start and stop monitors and services now accept NULL parameters.
This commit is contained in:
@ -164,6 +164,8 @@ monitor_free(MXS_MONITOR *mon)
|
||||
void
|
||||
monitorStart(MXS_MONITOR *monitor, const MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
if (monitor)
|
||||
{
|
||||
spinlock_acquire(&monitor->lock);
|
||||
|
||||
if ((monitor->handle = (*monitor->module->startMonitor)(monitor, params)))
|
||||
@ -176,6 +178,7 @@ monitorStart(MXS_MONITOR *monitor, const MXS_CONFIG_PARAMETER* params)
|
||||
}
|
||||
|
||||
spinlock_release(&monitor->lock);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -203,6 +206,8 @@ void monitorStartAll()
|
||||
void
|
||||
monitorStop(MXS_MONITOR *monitor)
|
||||
{
|
||||
if (monitor)
|
||||
{
|
||||
spinlock_acquire(&monitor->lock);
|
||||
|
||||
/** Only stop the monitor if it is running */
|
||||
@ -223,6 +228,7 @@ monitorStop(MXS_MONITOR *monitor)
|
||||
}
|
||||
|
||||
spinlock_release(&monitor->lock);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -627,11 +627,11 @@ int service_launch_all()
|
||||
|
||||
bool serviceStop(SERVICE *service)
|
||||
{
|
||||
SERV_LISTENER *port;
|
||||
int listeners = 0;
|
||||
|
||||
port = service->ports;
|
||||
while (port)
|
||||
if (service)
|
||||
{
|
||||
for (SERV_LISTENER * port = service->ports; port; port = port->next)
|
||||
{
|
||||
if (port->listener && port->listener->session->state == SESSION_STATE_LISTENER)
|
||||
{
|
||||
@ -641,9 +641,10 @@ bool serviceStop(SERVICE *service)
|
||||
listeners++;
|
||||
}
|
||||
}
|
||||
port = port->next;
|
||||
}
|
||||
|
||||
service->state = SERVICE_STATE_STOPPED;
|
||||
}
|
||||
|
||||
return listeners > 0;
|
||||
}
|
||||
@ -658,11 +659,11 @@ bool serviceStop(SERVICE *service)
|
||||
*/
|
||||
bool serviceStart(SERVICE *service)
|
||||
{
|
||||
SERV_LISTENER *port;
|
||||
int listeners = 0;
|
||||
|
||||
port = service->ports;
|
||||
while (port)
|
||||
if (service)
|
||||
{
|
||||
for (SERV_LISTENER* port = service->ports; port; port = port->next)
|
||||
{
|
||||
if (port->listener && port->listener->session->state == SESSION_STATE_LISTENER_STOPPED)
|
||||
{
|
||||
@ -672,9 +673,11 @@ bool serviceStart(SERVICE *service)
|
||||
listeners++;
|
||||
}
|
||||
}
|
||||
port = port->next;
|
||||
}
|
||||
|
||||
service->state = SERVICE_STATE_STARTED;
|
||||
}
|
||||
|
||||
return listeners > 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user