projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Treewide: use bool instead of _Bool
[collectd.git]
/
src
/
mysql.c
diff --git
a/src/mysql.c
b/src/mysql.c
index
7fe6d76
..
1396e95
100644
(file)
--- a/
src/mysql.c
+++ b/
src/mysql.c
@@
-58,17
+58,17
@@
struct mysql_database_s /* {{{ */
int port;
int timeout;
int port;
int timeout;
-
_B
ool master_stats;
-
_B
ool slave_stats;
-
_B
ool innodb_stats;
-
_B
ool wsrep_stats;
+
b
ool master_stats;
+
b
ool slave_stats;
+
b
ool innodb_stats;
+
b
ool wsrep_stats;
-
_B
ool slave_notif;
-
_B
ool slave_io_running;
-
_B
ool slave_sql_running;
+
b
ool slave_notif;
+
b
ool slave_io_running;
+
b
ool slave_sql_running;
MYSQL *con;
MYSQL *con;
-
_B
ool is_connected;
+
b
ool is_connected;
};
typedef struct mysql_database_s mysql_database_t; /* }}} */
};
typedef struct mysql_database_s mysql_database_t; /* }}} */
@@
-270,12
+270,16
@@
static MYSQL *getconnection(mysql_database_t *db) {
}
db->is_connected = 0;
}
db->is_connected = 0;
+ /* Close the old connection before initializing a new one. */
+ if (db->con != NULL) {
+ mysql_close(db->con);
+ db->con = NULL;
+ }
+
+ db->con = mysql_init(NULL);
if (db->con == NULL) {
if (db->con == NULL) {
- db->con = mysql_init(NULL);
- if (db->con == NULL) {
- ERROR("mysql plugin: mysql_init failed: %s", mysql_error(db->con));
- return NULL;
- }
+ ERROR("mysql plugin: mysql_init failed: %s", mysql_error(db->con));
+ return NULL;
}
/* Configure TCP connect timeout (default: 0) */
}
/* Configure TCP connect timeout (default: 0) */