Fixed a memory leak in all the monitors when a failed mysql_ping to the database caused a reinitialization of MYSQL* connection.
This commit is contained in:
parent
daf5b80a6f
commit
fdd5a10478
@ -377,6 +377,8 @@ char *server_string;
|
||||
int read_timeout = handle->read_timeout;
|
||||
int write_timeout = handle->write_timeout;
|
||||
|
||||
if(database->con)
|
||||
mysql_close(database->con);
|
||||
database->con = mysql_init(NULL);
|
||||
|
||||
rc = mysql_options(database->con, MYSQL_OPT_CONNECT_TIMEOUT, (void *)&connect_timeout);
|
||||
|
@ -360,7 +360,8 @@ char *server_string;
|
||||
char *dpwd = decryptPassword(passwd);
|
||||
int rc;
|
||||
int read_timeout = 1;
|
||||
|
||||
if(database->con)
|
||||
mysql_close(database->con);
|
||||
database->con = mysql_init(NULL);
|
||||
|
||||
rc = mysql_options(database->con, MYSQL_OPT_READ_TIMEOUT, (void *)&read_timeout);
|
||||
|
@ -401,7 +401,8 @@ char *server_string;
|
||||
int connect_timeout = handle->connect_timeout;
|
||||
int read_timeout = handle->read_timeout;
|
||||
int write_timeout = handle->write_timeout;
|
||||
|
||||
if(database->con)
|
||||
mysql_close(database->con);
|
||||
database->con = mysql_init(NULL);
|
||||
|
||||
rc = mysql_options(database->con, MYSQL_OPT_CONNECT_TIMEOUT, (void *)&connect_timeout);
|
||||
|
@ -338,6 +338,8 @@ char *server_string;
|
||||
int read_timeout = handle->read_timeout;
|
||||
int write_timeout = handle->write_timeout;
|
||||
|
||||
if(database->con)
|
||||
mysql_close(database->con);
|
||||
database->con = mysql_init(NULL);
|
||||
|
||||
rc = mysql_options(database->con, MYSQL_OPT_CONNECT_TIMEOUT, (void *)&connect_timeout);
|
||||
|
Loading…
x
Reference in New Issue
Block a user