MXS-22: Shutting down monitor now closes database connections

Shutting down monitors is not supposed to be done ofter so there is no true
benefit from keeping the connections open. With the refactoring of the monitor
interface, this can be done in a centralized place.
This commit is contained in:
Markus Makela 2016-02-04 11:48:01 +02:00
parent 9e33f300b0
commit 4f2a87f732

View File

@ -186,12 +186,22 @@ void monitorStartAll()
void
monitorStop(MONITOR *monitor)
{
spinlock_acquire(&monitor->lock);
if (monitor->state != MONITOR_STATE_STOPPED)
{
monitor->state = MONITOR_STATE_STOPPING;
monitor->module->stopMonitor(monitor);
monitor->state = MONITOR_STATE_STOPPED;
MONITOR_SERVERS* db = monitor->databases;
while (db)
{
mysql_close(db->con);
db->con = NULL;
db = db->next;
}
}
spinlock_release(&monitor->lock);
}
/**