about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-02-18 23:37:17 +0000
committerEric Wong <normalperson@yhbt.net>2013-02-18 23:37:17 +0000
commitf57064cc07d872583f50a04b2421f214304cc483 (patch)
tree43445befac3041905908e9c20fc93d6d584b613d
parentcbab5b9d18f13c22f6d94bdad2490e8d280ea927 (diff)
downloadcmogstored-f57064cc07d872583f50a04b2421f214304cc483.tar.gz
Despite having an extensive test suite and minimal room for user
error, giving users the options to back out of a hot upgrade may
be worth supporting.
-rw-r--r--cmogstored.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/cmogstored.c b/cmogstored.c
index 72400de..35b08f9 100644
--- a/cmogstored.c
+++ b/cmogstored.c
@@ -357,14 +357,23 @@ static void siginit(void (*wakeup_handler)(int))
         CHECK(int, 0, sigaction(SIGURG, &sa, NULL));
 
         sa.sa_handler = wakeup_handler;
+
+        /* TERM and INT are graceful shutdown for now, no immediate shutdown */
         CHECK(int, 0, sigaction(SIGTERM, &sa, NULL));
         CHECK(int, 0, sigaction(SIGINT, &sa, NULL));
 
-        /* TODO: graceful shutdown, upgrade, reload */
-        CHECK(int, 0, sigaction(SIGQUIT, &sa, NULL));
+        CHECK(int, 0, sigaction(SIGQUIT, &sa, NULL)); /* graceful shutdown */
+        CHECK(int, 0, sigaction(SIGUSR1, &sa, NULL)); /* no-op, nginx compat */
+        CHECK(int, 0, sigaction(SIGUSR2, &sa, NULL)); /* upgrade */
+
+        /*
+         * SIGWINCH/SIGHUP are no-ops for now to allow reuse of nginx init
+         * scripts.  We should support them in the future.
+         * SIGWINCH will disable new connections and drop idlers
+         * SIGHUP will reenable new connections/idlers after SIGWINCH
+         */
+        CHECK(int, 0, sigaction(SIGWINCH, &sa, NULL));
         CHECK(int, 0, sigaction(SIGHUP, &sa, NULL));
-        CHECK(int, 0, sigaction(SIGUSR1, &sa, NULL));
-        CHECK(int, 0, sigaction(SIGUSR2, &sa, NULL));
 
         sa.sa_flags = SA_NOCLDSTOP;
         CHECK(int, 0, sigaction(SIGCHLD, &sa, NULL));