[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-donau] branch master updated: [donau] remove suspended part from
From: |
gnunet |
Subject: |
[taler-donau] branch master updated: [donau] remove suspended part from donau-httpd_keys.c |
Date: |
Tue, 02 Jan 2024 13:39:59 +0100 |
This is an automated email from the git hooks/post-receive script.
lukas-matyja pushed a commit to branch master
in repository donau.
The following commit(s) were added to refs/heads/master by this push:
new b9919ed [donau] remove suspended part from donau-httpd_keys.c
b9919ed is described below
commit b9919ed5e902dac03bf719f4d31dc822fc66b572
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
AuthorDate: Tue Jan 2 13:40:41 2024 +0100
[donau] remove suspended part from donau-httpd_keys.c
---
src/donau/donau-httpd_keys.c | 169 -------------------------------------------
1 file changed, 169 deletions(-)
diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c
index a3b6573..68c4d4c 100644
--- 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.
*/
@@ -345,28 +316,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.
*/
@@ -404,89 +353,6 @@ static struct TALER_SecurityModulePublicKeyP esign_sm_pub;
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.
*
@@ -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,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-donau] branch master updated: [donau] remove suspended part from donau-httpd_keys.c,
gnunet <=