donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit b9919ed5e902dac03bf719f4d31dc822fc66b572
parent a49663396b12c82342891edc3012550df40a2d84
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date:   Tue,  2 Jan 2024 13:40:41 +0100

[donau] remove suspended part from donau-httpd_keys.c

Diffstat:
Msrc/donau/donau-httpd_keys.c | 169-------------------------------------------------------------------------------
1 file changed, 0 insertions(+), 169 deletions(-)

diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c @@ -304,35 +304,6 @@ struct DH_KeyStateHandle }; - -/** - * Entry of /keys requests that are currently suspended because we are - * waiting for /keys to become ready. - */ -struct SuspendedKeysRequests -{ - /** - * Kept in a DLL. - */ - struct SuspendedKeysRequests *next; - - /** - * Kept in a DLL. - */ - struct SuspendedKeysRequests *prev; - - /** - * The suspended connection. - */ - struct MHD_Connection *connection; - - /** - * When does this request timeout? - */ - struct GNUNET_TIME_Absolute timeout; -}; - - /** * Stores the latest generation of our key state. */ @@ -346,28 +317,6 @@ static struct DH_KeyStateHandle *key_state; static uint64_t key_generation; /** - * Head of DLL of suspended /keys requests. - */ -static struct SuspendedKeysRequests *skr_head; - -/** - * Tail of DLL of suspended /keys requests. - */ -static struct SuspendedKeysRequests *skr_tail; - -/** - * Number of entries in the @e skr_head DLL. - */ -static unsigned int skr_size; - -/** - * Handle to a connection that should be force-resumed - * with a hard error due to @a skr_size hitting - * #SKR_LIMIT. - */ -static struct MHD_Connection *skr_connection; - -/** * Task to force timeouts on /keys requests. */ static struct GNUNET_SCHEDULER_Task *keys_tt; @@ -405,89 +354,6 @@ static bool terminating; /** - * Function called to forcefully resume suspended keys requests. - * - * @param cls unused, NULL - */ -static void -keys_timeout_cb (void *cls) -{ - struct SuspendedKeysRequests *skr; - - (void) cls; - keys_tt = NULL; - while (NULL != (skr = skr_head)) - { - if (GNUNET_TIME_absolute_is_future (skr->timeout)) - break; - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Resuming /keys request due to timeout\n"); - GNUNET_CONTAINER_DLL_remove (skr_head, - skr_tail, - skr); - MHD_resume_connection (skr->connection); - TALER_MHD_daemon_trigger (); - GNUNET_free (skr); - } - if (NULL == skr) - return; - keys_tt = GNUNET_SCHEDULER_add_at (skr->timeout, - &keys_timeout_cb, - NULL); -} - - -/** - * Suspend /keys request while we (hopefully) are waiting to be - * provisioned with key material. - * - * @param[in] connection to suspend - */ -static MHD_RESULT -suspend_request (struct MHD_Connection *connection) -{ - struct SuspendedKeysRequests *skr; - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Suspending /keys request until key material changes\n"); - if (terminating) - { - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DONAU_GENERIC_KEYS_MISSING, - "Donau terminating"); - } - skr = GNUNET_new (struct SuspendedKeysRequests); - skr->connection = connection; - MHD_suspend_connection (connection); - GNUNET_CONTAINER_DLL_insert (skr_head, - skr_tail, - skr); - skr->timeout = GNUNET_TIME_relative_to_absolute (KEYS_TIMEOUT); - if (NULL == keys_tt) - { - keys_tt = GNUNET_SCHEDULER_add_at (skr->timeout, - &keys_timeout_cb, - NULL); - } - skr_size++; - if (skr_size > SKR_LIMIT) - { - skr = skr_tail; - GNUNET_CONTAINER_DLL_remove (skr_head, - skr_tail, - skr); - skr_size--; - skr_connection = skr->connection; - MHD_resume_connection (skr->connection); - TALER_MHD_daemon_trigger (); - GNUNET_free (skr); - } - return MHD_YES; -} - - -/** * Called on each denomination key. Checks that the key still works. * * @param cls NULL @@ -529,26 +395,6 @@ DH_check_invariants () } -void -DH_resume_keys_requests (bool do_shutdown) -{ - struct SuspendedKeysRequests *skr; - - if (do_shutdown) - terminating = true; - while (NULL != (skr = skr_head)) - { - GNUNET_CONTAINER_DLL_remove (skr_head, - skr_tail, - skr); - skr_size--; - MHD_resume_connection (skr->connection); - TALER_MHD_daemon_trigger (); - GNUNET_free (skr); - } -} - - /** * Clear memory for responses to "/keys" in @a ksh. * @@ -2855,21 +2701,6 @@ DH_keys_get_handler (struct DH_RequestContext *rc, ksh = DH_keys_get_state (); if ( (NULL == ksh) || (0 == ksh->krd_array_length) ) - { - if ( ( (SKR_LIMIT == skr_size) && - (rc->connection == skr_connection) ) || - DH_suicide) - { - return TALER_MHD_reply_with_error ( - rc->connection, - MHD_HTTP_SERVICE_UNAVAILABLE, - TALER_EC_DONAU_GENERIC_KEYS_MISSING, - DH_suicide - ? "server terminating" - : "too many connections suspended waiting on /keys"); - } - return suspend_request (rc->connection); - } krd = bsearch (&last_issue_date, ksh->krd_array, ksh->krd_array_length,