From: Marko Kreen Date: Mon, 4 Aug 2008 11:08:23 +0000 (+0000) Subject: cancel shutdown on resume X-Git-Tag: pgbouncer_1_2_2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df2192cab52f832de623e16cce232900789c36c9;p=pgbouncer cancel shutdown on resume otherwise admin gets bad surprise on next pause --- diff --git a/src/admin.c b/src/admin.c index 4afab80..55f559b 100644 --- a/src/admin.c +++ b/src/admin.c @@ -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 */ diff --git a/src/main.c b/src/main.c index 645902b..6ee1b7b 100644 --- a/src/main.c +++ b/src/main.c @@ -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)