From f90a745abe0223d591567197983ddf60fcf70f59 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 13 Jul 2015 23:51:15 +0200 Subject: [PATCH] add -t option to httpd --- doc/taler-mint-httpd.1 | 3 +++ src/mint/taler-mint-httpd.c | 9 +++++++++ src/mintdb/plugin_mintdb_postgres.c | 2 ++ 3 files changed, 14 insertions(+) diff --git a/doc/taler-mint-httpd.1 b/doc/taler-mint-httpd.1 index 43587006e..9ff9774c4 100644 --- a/doc/taler-mint-httpd.1 +++ b/doc/taler-mint-httpd.1 @@ -25,6 +25,9 @@ Print version information. .IP "\-f FILENAME, \-\-file\-input=FILENAME" This option is only available if the mint was compiled with the configure option \-\-enable\-developer\-mode. It is used for generating test cases against the mint using AFL. When this option is present, the HTTP server will (1) terminate after the first client's HTTP connection is completed, and (2) automatically start such a client using a helper process based on the 'nc' or 'ncat' binary using FILENAME as the standard input to the helper process. As a result, the process will effectively run with FILENAME as the input from an HTTP client and then immediately exit. This is useful to test taler\-mint\-httpd against many different possible inputs in a controlled way. +.B +.IP \"-t SECONDS, \-\-timeout=SECONDS" +Specifies the number of SECONDS after which the HTTPD should close (idle) HTTP connections. .SH BUGS Report bugs by using Mantis or by sending electronic mail to diff --git a/src/mint/taler-mint-httpd.c b/src/mint/taler-mint-httpd.c index 14fde3ac7..cf825e6b1 100644 --- a/src/mint/taler-mint-httpd.c +++ b/src/mint/taler-mint-httpd.c @@ -74,6 +74,11 @@ struct TALER_MINTDB_Plugin *TMH_plugin; */ int TMH_test_mode; +/** + * Default timeout in seconds for HTTP requests. + */ +static unsigned int connection_timeout = 30; + /** * The HTTP Daemon. */ @@ -552,6 +557,9 @@ main (int argc, {'d', "mint-dir", "DIR", "mint directory with configuration and keys for operating the mint", 1, &GNUNET_GETOPT_set_filename, &TMH_mint_directory}, + {'t', "timeout", "SECONDS", + "after how long do connections timeout by default (in seconds)", 1, + &GNUNET_GETOPT_set_uint, &connection_timeout}, #if HAVE_DEVELOPER {'f', "file-input", "FILENAME", "run in test-mode using FILENAME as the HTTP request to process", 1, @@ -588,6 +596,7 @@ main (int argc, NULL, NULL, &handle_mhd_request, NULL, MHD_OPTION_NOTIFY_COMPLETED, &handle_mhd_completion_callback, NULL, + MHD_OPTION_CONNECTION_TIMEOUT, connection_timeout, #if HAVE_DEVELOPER MHD_OPTION_NOTIFY_CONNECTION, &connection_done, NULL, #endif diff --git a/src/mintdb/plugin_mintdb_postgres.c b/src/mintdb/plugin_mintdb_postgres.c index 8737809bc..ac0fcb7ea 100644 --- a/src/mintdb/plugin_mintdb_postgres.c +++ b/src/mintdb/plugin_mintdb_postgres.c @@ -166,6 +166,8 @@ static int postgres_drop_temporary (void *cls, struct TALER_MINTDB_Session *session) { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Dropping temporary tables\n"); SQLEXEC_ (session->conn, "DROP SCHEMA " TALER_TEMP_SCHEMA_NAME " CASCADE;"); return GNUNET_OK;