summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-01-20 12:10:44 +0100
committerChristian Grothoff <christian@grothoff.org>2020-01-20 12:10:44 +0100
commit52797133a472266c9e06fb5f66bd8793e443bd7e (patch)
tree0852b2d8d445fd22c58c9f6900fb30f94cfbc0e5 /src/exchange/taler-exchange-httpd.c
parent8a4201c43bd70032eecfeaa41a5d0b56a391c66a (diff)
downloadexchange-52797133a472266c9e06fb5f66bd8793e443bd7e.tar.gz
exchange-52797133a472266c9e06fb5f66bd8793e443bd7e.tar.bz2
exchange-52797133a472266c9e06fb5f66bd8793e443bd7e.zip
fix signal initialization race on startup with shutdown
Diffstat (limited to 'src/exchange/taler-exchange-httpd.c')
-rw-r--r--src/exchange/taler-exchange-httpd.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index c0e91250d..666cec0c1 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -983,7 +983,7 @@ main (int argc,
char *cfgfile = NULL;
char *loglev = NULL;
char *logfile = NULL;
- int connection_close;
+ int connection_close = GNUNET_NO;
const struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_flag ('C',
"connection-close",
@@ -1084,31 +1084,32 @@ main (int argc,
}
/* initialize #internal_key_state with an RC of 1 */
- TEH_KS_init ();
-
- /* consider unix path */
- if ( (-1 == fh) &&
- (NULL != serve_unixpath) )
+ if (GNUNET_OK ==
+ TEH_KS_init ())
{
- fh = TALER_MHD_open_unix_path (serve_unixpath,
- unixpath_mode);
- if (-1 == fh)
- return 1;
- }
#if HAVE_DEVELOPER
- if (NULL != input_filename)
- {
- if (-1 != fh)
- GNUNET_break (0 == close (fh));
- ret = run_single_request ();
- }
- else
+ if (NULL != input_filename)
+ {
+ ret = run_single_request ();
+ }
+ else
#endif
- ret = run_main_loop (fh,
- argv);
-
- /* release #internal_key_state */
- TEH_KS_free ();
+ {
+ /* consider unix path */
+ if ( (-1 == fh) &&
+ (NULL != serve_unixpath) )
+ {
+ fh = TALER_MHD_open_unix_path (serve_unixpath,
+ unixpath_mode);
+ if (-1 == fh)
+ return 1;
+ }
+ ret = run_main_loop (fh,
+ argv);
+ }
+ /* release #internal_key_state */
+ TEH_KS_free ();
+ }
TALER_EXCHANGEDB_plugin_unload (TEH_plugin);
TEH_VALIDATION_done ();
return (GNUNET_SYSERR == ret) ? 1 : 0;