Skip to content

Commit

Permalink
drop all connections from MySQL_Monitor_Connection_Pool() when shutti…
Browse files Browse the repository at this point in the history
…ng down

Issues #490 and #473
  • Loading branch information
renecannao committed Feb 27, 2016
1 parent 01a5a71 commit 3a1912c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/MySQL_Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -100,6 +101,9 @@ void MySQL_Monitor_Connection_Pool::purge_missing_servers(SQLite3_result *result
std::list<MYSQL *> *purge_lst=NULL;
purge_lst=new std::list<MYSQL *>;
pthread_mutex_lock(&mutex);
if (resultset==NULL) {
goto __purge_all;
}
for (std::vector<SQLite3_row *>::iterator it = resultset->rows.begin() ; it != resultset->rows.end(); ++it) {
// for each host configured ...
SQLite3_row *r=*it;
Expand All @@ -118,6 +122,7 @@ void MySQL_Monitor_Connection_Pool::purge_missing_servers(SQLite3_result *result
}
}
}
__purge_all:
std::map<char *, std::list<MYSQL *>*>::iterator it;
//std::map<std::string, std::map<std::string, std::string>>::iterator it_type;
for(it = my_connections.begin(); it != my_connections.end(); it++) {
Expand Down Expand Up @@ -640,6 +645,7 @@ MySQL_Monitor::~MySQL_Monitor() {
delete tables_defs_monitor;
delete monitordb;
delete admindb;
delete My_Conn_Pool;
};


Expand Down

0 comments on commit 3a1912c

Please sign in to comment.