Shutdown all monitors when shutting down the gateway
This commit is contained in:
parent
7cdffb26e6
commit
8482c560f7
@ -50,6 +50,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <mysql.h>
|
||||
#include <monitor.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
@ -407,6 +408,9 @@ char ddopt[1024];
|
||||
for (n = 0; n < n_threads - 1; n++)
|
||||
thread_wait(threads[n]);
|
||||
|
||||
/* Stop all the monitors */
|
||||
monitorStopAll();
|
||||
|
||||
skygw_log_write(NULL, LOGFILE_MESSAGE, "MaxScale shutdown, PID %i\n", getpid());
|
||||
|
||||
return 0;
|
||||
|
@ -104,6 +104,24 @@ MONITOR *ptr;
|
||||
free(mon);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shutdown all running monitors
|
||||
*/
|
||||
void
|
||||
monitorStopAll()
|
||||
{
|
||||
MONITOR *ptr;
|
||||
|
||||
spinlock_acquire(&monLock);
|
||||
ptr = allMonitors;
|
||||
while (ptr)
|
||||
{
|
||||
ptr->module->stopMonitor(ptr->handle);
|
||||
ptr = ptr->next;
|
||||
}
|
||||
spinlock_release(&monLock);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a server to a monitor. Simply register the server that needs to be
|
||||
* monitored to the running monitor module.
|
||||
|
@ -39,7 +39,7 @@ static int
|
||||
secrets_random_str(unsigned char *output, int len)
|
||||
{
|
||||
int i;
|
||||
srand(time(0L));
|
||||
srand((unsigned long )time(0L) ^ (unsigned long )output);
|
||||
|
||||
for ( i = 0; i < len; ++i )
|
||||
{
|
||||
|
@ -78,4 +78,5 @@ extern MONITOR *monitor_alloc(char *, char *);
|
||||
extern void monitor_free(MONITOR *);
|
||||
extern void monitorAddServer(MONITOR *, SERVER *);
|
||||
extern void monitorAddUser(MONITOR *, char *, char *);
|
||||
extern void monitorStopAll();
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user