]> granicus.if.org Git - pgbouncer/commitdiff
cancel shutdown on resume
authorMarko Kreen <markokr@gmail.com>
Mon, 4 Aug 2008 11:08:23 +0000 (11:08 +0000)
committerMarko Kreen <markokr@gmail.com>
Mon, 4 Aug 2008 11:08:23 +0000 (11:08 +0000)
otherwise admin gets bad surprise on next pause

src/admin.c
src/main.c

index 4afab804f212b6400aa0becb9f07cbf06cac359d..55f559b118cd5181857b11c22416ceac338b6cf2 100644 (file)
@@ -807,6 +807,12 @@ static void full_resume(void)
        cf_pause_mode = P_NONE;
        if (tmp_mode == P_SUSPEND)
                resume_all();
+
+       /* avoid surprise later if cf_shutdown stays set */
+       if (cf_shutdown) {
+               log_info("canceling shutdown");
+               cf_shutdown = 0;
+       }
 }
 
 /* Command: RESUME */
index 645902b5f0a986f6b79dabe708e19028b049669c..6ee1b7bd4af4af7e84d732fd33bad4dcdd7b893c 100644 (file)
@@ -319,7 +319,7 @@ static void handle_sigint(int sock, short flags, void *arg)
 
 static void handle_sigusr1(int sock, short flags, void *arg)
 {
-       if (cf_pause_mode == 0) {
+       if (cf_pause_mode == P_NONE) {
                log_info("Got SIGUSR1, pausing all activity");
                cf_pause_mode = P_PAUSE;
        } else {
@@ -333,15 +333,21 @@ static void handle_sigusr2(int sock, short flags, void *arg)
        case P_SUSPEND:
                log_info("Got SIGUSR2, continuing from SUSPEND");
                resume_all();
-               cf_pause_mode = 0;
+               cf_pause_mode = P_NONE;
                break;
        case P_PAUSE:
                log_info("Got SIGUSR2, continuing from PAUSE");
-               cf_pause_mode = 0;
+               cf_pause_mode = P_NONE;
                break;
        case P_NONE:
                log_info("Got SIGUSR1, but not paused/suspended");
        }
+
+       /* avoid surprise later if cf_shutdown stays set */
+       if (cf_shutdown) {
+               log_info("Canceling shutdown");
+               cf_shutdown = 0;
+       }
 }
 
 static void handle_sighup(int sock, short flags, void *arg)