From 7c03a6c8f8d9ffcc3f0152e74c629213487b6d64 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Wed, 24 Feb 2016 21:15:15 +0200 Subject: [PATCH] Skip cleanup if there is takeover --- include/admin.h | 3 +++ src/admin.c | 4 ++++ src/main.c | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/admin.h b/include/admin.h index 87d7ee9..08cb99a 100644 --- a/include/admin.h +++ b/include/admin.h @@ -15,6 +15,9 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +extern bool got_show_fds; + bool admin_handle_client(PgSocket *client, PktHdr *pkt) _MUSTCHECK; bool admin_pre_login(PgSocket *client, const char *username) _MUSTCHECK; bool admin_post_login(PgSocket *client) _MUSTCHECK; diff --git a/src/admin.c b/src/admin.c index 735a21a..74fed1a 100644 --- a/src/admin.c +++ b/src/admin.c @@ -69,6 +69,8 @@ static PgPool *admin_pool; /* only valid during processing */ static const char *current_query; +bool got_show_fds; + void admin_cleanup(void) { regfree(&rc_cmd); @@ -369,6 +371,8 @@ static bool show_fds_from_list(PgSocket *admin, struct StatList *list) PgSocket *sk; bool res = true; + got_show_fds = true; + statlist_for_each(item, list) { sk = container_of(item, PgSocket, head); res = show_one_fd(admin, sk); diff --git a/src/main.c b/src/main.c index 44e4d4b..16eca88 100644 --- a/src/main.c +++ b/src/main.c @@ -922,7 +922,9 @@ int main(int argc, char *argv[]) while (cf_shutdown < 2) main_loop_once(); - cleanup(); + /* proper cleanup, unless there is takeover */ + if (!got_show_fds) + cleanup(); return 0; } -- 2.40.0