]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
db: disable SIGHUP if ring buffer is used.
authorEric Leblond <eric@regit.org>
Thu, 9 May 2013 09:20:37 +0000 (11:20 +0200)
committerEric Leblond <eric@regit.org>
Tue, 21 May 2013 17:57:07 +0000 (19:57 +0200)
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

index dae8897e6a48718f4b2a97d5eb48d7dce4729717..1e10bfa0aaaf554c94f41aeb534ed92203e82b4c 100644 (file)
--- 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;