summaryrefslogtreecommitdiffstats
path: root/util/db.c
diff options
context:
space:
mode:
authorEric Leblond <eric@regit.org>2013-05-09 11:20:37 +0200
committerEric Leblond <eric@regit.org>2013-05-21 19:57:07 +0200
commitc6bfadfdf8aef2dc84eabade6b4198fec7b00b44 (patch)
treeaadd901a742b457a0ec3d2158af84a623a3967b1 /util/db.c
parentbc817c2077ddfb37041a20cf7c71bc71b4d56003 (diff)
db: disable SIGHUP if ring buffer is used.
The handling of signal when using threads can be complicated. When ring buffer is used for query, this means ulogd will have to follow some sort of mutex. Thus, it is easier and better performance wise to disable the reload via SIGHUP when the ring buffer is used.
Diffstat (limited to 'util/db.c')
-rw-r--r--util/db.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/util/db.c b/util/db.c
index dae8897..1e10bfa 100644
--- a/util/db.c
+++ b/util/db.c
@@ -606,11 +606,16 @@ static void *__inject_thread(void *gdi)
void ulogd_db_signal(struct ulogd_pluginstance *upi, int signal)
{
+ struct db_instance *di = (struct db_instance *) &upi->private;
switch (signal) {
case SIGHUP:
- /* reopen database connection */
- ulogd_db_instance_stop(upi);
- ulogd_db_start(upi);
+ if (!di->ring.size) {
+ /* reopen database connection */
+ ulogd_db_instance_stop(upi);
+ ulogd_db_start(upi);
+ } else
+ ulogd_log(ULOGD_ERROR,
+ "No SIGHUP handling if ring buffer is used\n");
break;
default:
break;