From 20c0c01d02f6b388af3ef26db0b7c4953e7a9213 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 15 Dec 2020 14:40:08 +0100 Subject: fix new /keys shutdown sequence --- src/exchange/taler-exchange-httpd.c | 8 ++++---- src/exchange/taler-exchange-httpd_keys.c | 15 ++++----------- src/exchange/taler-exchange-httpd_keys.h | 10 ++-------- 3 files changed, 10 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index 19bba0b8b..6009672f1 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -1417,7 +1417,7 @@ run_single_request (void) } MHD_run (mhd); } - TEH_resume_keys_requests (); + TEH_resume_keys_requests (true); MHD_stop_daemon (mhd); mhd = NULL; if (cld != waitpid (cld, @@ -1486,7 +1486,7 @@ run_main_loop (int fh, { case GNUNET_OK: case GNUNET_SYSERR: - TEH_resume_keys_requests (); + TEH_resume_keys_requests (true); MHD_stop_daemon (mhd); break; case GNUNET_NO: @@ -1542,13 +1542,13 @@ run_main_loop (int fh, num_connections) sleep (1); /* Now we're really done, practice clean shutdown */ - TEH_resume_keys_requests (); + TEH_resume_keys_requests (true); MHD_stop_daemon (mhd); } break; default: GNUNET_break (0); - TEH_resume_keys_requests (); + TEH_resume_keys_requests (true); MHD_stop_daemon (mhd); break; } diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c index adc950792..d51e8b3d5 100644 --- a/src/exchange/taler-exchange-httpd_keys.c +++ b/src/exchange/taler-exchange-httpd_keys.c @@ -417,11 +417,13 @@ suspend_request (struct MHD_Connection *connection) void -TEH_resume_keys_requests (void) +TEH_resume_keys_requests (bool do_shutdown) { struct SuspendedKeysRequests *skr; GNUNET_assert (0 == pthread_mutex_lock (&skr_mutex)); + if (do_shutdown) + terminating = true; while (NULL != (skr = skr_head)) { GNUNET_CONTAINER_DLL_remove (skr_head, @@ -903,15 +905,6 @@ TEH_keys_init () } -void -TEH_keys_done () -{ - GNUNET_assert (0 == pthread_mutex_lock (&skr_mutex)); - terminating = true; - GNUNET_assert (0 == pthread_mutex_unlock (&skr_mutex)); -} - - /** * Fully clean up our state. */ @@ -1699,7 +1692,7 @@ TEH_keys_update_states () { __sync_fetch_and_add (&key_generation, 1); - TEH_resume_keys_requests (); + TEH_resume_keys_requests (false); } diff --git a/src/exchange/taler-exchange-httpd_keys.h b/src/exchange/taler-exchange-httpd_keys.h index 6966290f3..1bdabd0fd 100644 --- a/src/exchange/taler-exchange-httpd_keys.h +++ b/src/exchange/taler-exchange-httpd_keys.h @@ -197,10 +197,10 @@ TEH_keys_denomination_revoke (const struct GNUNET_HashCode *h_denom_pub); * Resumse all suspended /keys requests, we may now have key material * (or are shuting down). * - * @param[in] connection to suspend + * @param do_shutdown are we shutting down? */ void -TEH_resume_keys_requests (void); +TEH_resume_keys_requests (bool do_shutdown); /** @@ -329,11 +329,5 @@ TEH_keys_get_timing (const struct TALER_ExchangePublicKeyP *exchange_pub, int TEH_keys_init (void); -/** - * Close down keys submodule. - */ -void -TEH_keys_done (void); - #endif -- cgit v1.2.3