From 19e26b39ba4b571b36883cb4fc08a16d4b7b1c38 Mon Sep 17 00:00:00 2001 From: "/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org" Date: Sat, 5 Apr 2008 14:02:56 +0000 Subject: 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 --- include/ulogd/db.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') 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", \ -- cgit v1.2.3