summaryrefslogtreecommitdiffstats
path: root/include/ulogd
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-04-05 14:02:56 +0000
committer/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-04-05 14:02:56 +0000
commit19e26b39ba4b571b36883cb4fc08a16d4b7b1c38 (patch)
tree8b60b0e6570d10af67e0eda53d361a46d5f40a2e /include/ulogd
parent627afbf16b96d23dc0eb7b8e87575c3b9b54e72b (diff)
This patch fixes a problem in SQL reconnection algorithm which is managed in
the db.c file for PgSQL and MySQL. In case of problem during request execution a new connection to the database was immediatly started without closing the previous one. The consequence was to block the database by having too much simultaneous open connections. This patch fixes the problem by disconnectinng from the database after a request failure and trying to reconnect after a delay which is by default of 2 secondes. This delay can be customized via the reconnect configuration variable in the database configuration section. Signed-off-by: Eric Leblond <eric@inl.fr>
Diffstat (limited to 'include/ulogd')
-rw-r--r--include/ulogd/db.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/ulogd/db.h b/include/ulogd/db.h
index 94cdbcb..62819f2 100644
--- a/include/ulogd/db.h
+++ b/include/ulogd/db.h
@@ -23,6 +23,7 @@ struct db_instance {
struct db_driver *driver;
};
#define TIME_ERR ((time_t)-1) /* Be paranoid */
+#define RECONNECT_DEFAULT 2
#define DB_CES \
{ \
@@ -33,6 +34,7 @@ struct db_instance {
{ \
.key = "reconnect", \
.type = CONFIG_TYPE_INT, \
+ .u.value = RECONNECT_DEFAULT, \
}, \
{ \
.key = "ip_as_string", \