From 3a1912cf4999638942a66724628cc96387b548cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Sat, 27 Feb 2016 20:44:27 +0000 Subject: [PATCH] drop all connections from MySQL_Monitor_Connection_Pool() when shutting down Issues #490 and #473 --- lib/MySQL_Monitor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/MySQL_Monitor.cpp b/lib/MySQL_Monitor.cpp index ddfc30a77..4b25c0eaf 100644 --- a/lib/MySQL_Monitor.cpp +++ b/lib/MySQL_Monitor.cpp @@ -88,6 +88,7 @@ MySQL_Monitor_Connection_Pool::MySQL_Monitor_Connection_Pool() { } MySQL_Monitor_Connection_Pool::~MySQL_Monitor_Connection_Pool() { + purge_missing_servers(NULL); } void MySQL_Monitor_Connection_Pool::purge_missing_servers(SQLite3_result *resultset) { @@ -100,6 +101,9 @@ void MySQL_Monitor_Connection_Pool::purge_missing_servers(SQLite3_result *result std::list *purge_lst=NULL; purge_lst=new std::list; pthread_mutex_lock(&mutex); + if (resultset==NULL) { + goto __purge_all; + } for (std::vector::iterator it = resultset->rows.begin() ; it != resultset->rows.end(); ++it) { // for each host configured ... SQLite3_row *r=*it; @@ -118,6 +122,7 @@ void MySQL_Monitor_Connection_Pool::purge_missing_servers(SQLite3_result *result } } } +__purge_all: std::map*>::iterator it; //std::map>::iterator it_type; for(it = my_connections.begin(); it != my_connections.end(); it++) { @@ -640,6 +645,7 @@ MySQL_Monitor::~MySQL_Monitor() { delete tables_defs_monitor; delete monitordb; delete admindb; + delete My_Conn_Pool; };