aboutsummaryrefslogtreecommitdiff
path: root/src/mint/taler-mint-httpd_keystate.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-09-21 10:43:22 +0200
committerChristian Grothoff <christian@grothoff.org>2015-09-21 10:43:22 +0200
commita9f01707ad64fc554077ca109ba03128ed8294be (patch)
treea2dbd07b39e5a4a38db501050dbd2c01fd8f83ec /src/mint/taler-mint-httpd_keystate.c
parent49d8426cf444daaf97c195096c5f59bf010b16d0 (diff)
downloadexchange-a9f01707ad64fc554077ca109ba03128ed8294be.tar.xz
add option -C to force closing of connections
Diffstat (limited to 'src/mint/taler-mint-httpd_keystate.c')
-rw-r--r--src/mint/taler-mint-httpd_keystate.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mint/taler-mint-httpd_keystate.c b/src/mint/taler-mint-httpd_keystate.c
index 939d57d03..6a0bad540 100644
--- a/src/mint/taler-mint-httpd_keystate.c
+++ b/src/mint/taler-mint-httpd_keystate.c
@@ -23,6 +23,7 @@
#include "platform.h"
#include <pthread.h>
#include "taler-mint-httpd_keystate.h"
+#include "taler-mint-httpd_responses.h"
#include "taler_mintdb_plugin.h"
@@ -814,6 +815,17 @@ handle_sighup ()
/**
+ * Call #handle_signal() to pass the received signal via
+ * the control pipe.
+ */
+static void
+handle_sigchld ()
+{
+ handle_signal (SIGCHLD);
+}
+
+
+/**
* Read signals from a pipe in a loop, and reload keys from disk if
* SIGUSR1 is received, terminate if SIGTERM/SIGINT is received, and
* restart if SIGHUP is received.
@@ -829,6 +841,7 @@ TMH_KS_loop (void)
struct GNUNET_SIGNAL_Context *sigterm;
struct GNUNET_SIGNAL_Context *sigint;
struct GNUNET_SIGNAL_Context *sighup;
+ struct GNUNET_SIGNAL_Context *sigchld;
int ret;
if (0 != pipe (reload_pipe))
@@ -845,6 +858,8 @@ TMH_KS_loop (void)
&handle_sigint);
sighup = GNUNET_SIGNAL_handler_install (SIGHUP,
&handle_sighup);
+ sigchld = GNUNET_SIGNAL_handler_install (SIGCHLD,
+ &handle_sigchld);
ret = 0;
while (0 == ret)
@@ -890,6 +905,12 @@ read_again:
/* restart updated binary */
ret = GNUNET_NO;
break;
+#if HAVE_DEVELOPER
+ case SIGCHLD:
+ /* running in test-mode, test finished, terminate */
+ ret = GNUNET_OK;
+ break;
+#endif
default:
/* unexpected character */
GNUNET_break (0);
@@ -905,6 +926,7 @@ read_again:
GNUNET_SIGNAL_handler_uninstall (sigterm);
GNUNET_SIGNAL_handler_uninstall (sigint);
GNUNET_SIGNAL_handler_uninstall (sighup);
+ GNUNET_SIGNAL_handler_uninstall (sigchld);
return ret;
}
@@ -966,6 +988,7 @@ TMH_KS_handler_keys (struct TMH_RequestHandler *rh,
GNUNET_break (0);
return MHD_NO;
}
+ TMH_RESPONSE_add_global_headers (response);
(void) MHD_add_response_header (response,
"Content-Type",
rh->mime_type);