fix new /keys shutdown sequence

This commit is contained in:
Christian Grothoff 2020-12-15 14:40:08 +01:00
parent 4a519078e8
commit 20c0c01d02
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 10 additions and 23 deletions

View File

@ -1417,7 +1417,7 @@ run_single_request (void)
} }
MHD_run (mhd); MHD_run (mhd);
} }
TEH_resume_keys_requests (); TEH_resume_keys_requests (true);
MHD_stop_daemon (mhd); MHD_stop_daemon (mhd);
mhd = NULL; mhd = NULL;
if (cld != waitpid (cld, if (cld != waitpid (cld,
@ -1486,7 +1486,7 @@ run_main_loop (int fh,
{ {
case GNUNET_OK: case GNUNET_OK:
case GNUNET_SYSERR: case GNUNET_SYSERR:
TEH_resume_keys_requests (); TEH_resume_keys_requests (true);
MHD_stop_daemon (mhd); MHD_stop_daemon (mhd);
break; break;
case GNUNET_NO: case GNUNET_NO:
@ -1542,13 +1542,13 @@ run_main_loop (int fh,
num_connections) num_connections)
sleep (1); sleep (1);
/* Now we're really done, practice clean shutdown */ /* Now we're really done, practice clean shutdown */
TEH_resume_keys_requests (); TEH_resume_keys_requests (true);
MHD_stop_daemon (mhd); MHD_stop_daemon (mhd);
} }
break; break;
default: default:
GNUNET_break (0); GNUNET_break (0);
TEH_resume_keys_requests (); TEH_resume_keys_requests (true);
MHD_stop_daemon (mhd); MHD_stop_daemon (mhd);
break; break;
} }

View File

@ -417,11 +417,13 @@ suspend_request (struct MHD_Connection *connection)
void void
TEH_resume_keys_requests (void) TEH_resume_keys_requests (bool do_shutdown)
{ {
struct SuspendedKeysRequests *skr; struct SuspendedKeysRequests *skr;
GNUNET_assert (0 == pthread_mutex_lock (&skr_mutex)); GNUNET_assert (0 == pthread_mutex_lock (&skr_mutex));
if (do_shutdown)
terminating = true;
while (NULL != (skr = skr_head)) while (NULL != (skr = skr_head))
{ {
GNUNET_CONTAINER_DLL_remove (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. * Fully clean up our state.
*/ */
@ -1699,7 +1692,7 @@ TEH_keys_update_states ()
{ {
__sync_fetch_and_add (&key_generation, __sync_fetch_and_add (&key_generation,
1); 1);
TEH_resume_keys_requests (); TEH_resume_keys_requests (false);
} }

View File

@ -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 * Resumse all suspended /keys requests, we may now have key material
* (or are shuting down). * (or are shuting down).
* *
* @param[in] connection to suspend * @param do_shutdown are we shutting down?
*/ */
void 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 int
TEH_keys_init (void); TEH_keys_init (void);
/**
* Close down keys submodule.
*/
void
TEH_keys_done (void);
#endif #endif