summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-12-15 14:40:08 +0100
committerChristian Grothoff <christian@grothoff.org>2020-12-15 14:40:08 +0100
commit20c0c01d02f6b388af3ef26db0b7c4953e7a9213 (patch)
tree60be627959286868f29122dc8be778122108e272 /src/exchange
parent4a519078e803c8ff042833a2200c5b6a0297fbe7 (diff)
downloadexchange-20c0c01d02f6b388af3ef26db0b7c4953e7a9213.tar.gz
exchange-20c0c01d02f6b388af3ef26db0b7c4953e7a9213.tar.bz2
exchange-20c0c01d02f6b388af3ef26db0b7c4953e7a9213.zip
fix new /keys shutdown sequence
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-httpd.c8
-rw-r--r--src/exchange/taler-exchange-httpd_keys.c15
-rw-r--r--src/exchange/taler-exchange-httpd_keys.h10
3 files changed, 10 insertions, 23 deletions
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