From c6bfadfdf8aef2dc84eabade6b4198fec7b00b44 Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Thu, 9 May 2013 11:20:37 +0200 Subject: 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. --- util/db.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'util') 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; -- cgit v1.2.3