[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 12/31: test_https_time_out: second attempt to really che
From: |
gnunet |
Subject: |
[libmicrohttpd] 12/31: test_https_time_out: second attempt to really check something with this test |
Date: |
Mon, 10 Oct 2022 13:00:57 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit a710f6270813ad935a98893b483d58814f17cdf8
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Thu Oct 6 08:52:46 2022 +0300
test_https_time_out: second attempt to really check something with this test
---
src/testcurl/https/test_https_time_out.c | 37 ++++++++++++++++++++++----------
1 file changed, 26 insertions(+), 11 deletions(-)
diff --git a/src/testcurl/https/test_https_time_out.c
b/src/testcurl/https/test_https_time_out.c
index 86859ca3..8893c16b 100644
--- a/src/testcurl/https/test_https_time_out.c
+++ b/src/testcurl/https/test_https_time_out.c
@@ -54,10 +54,10 @@
#endif
#include "tls_test_keys.h"
-static const int TIME_OUT = 2;
+static const unsigned int timeout_val = 2;
-static unsigned int num_connects = 0;
-static unsigned int num_disconnects = 0;
+static volatile unsigned int num_connects = 0;
+static volatile unsigned int num_disconnects = 0;
/**
@@ -104,18 +104,27 @@ socket_cb (void *cls,
void **socket_context,
enum MHD_ConnectionNotificationCode toe)
{
- struct sckt_notif_cb_param *param = (struct sckt_notif_cb_param *) cls;
if (NULL == socket_context)
abort ();
if (NULL == c)
abort ();
- if (NULL == param)
+ if (NULL != cls)
abort ();
if (MHD_CONNECTION_NOTIFY_STARTED == toe)
+ {
num_connects++;
+#ifdef _DEBUG
+ fprintf (stderr, "MHD: Connection has started.\n");
+#endif /* _DEBUG */
+ }
else if (MHD_CONNECTION_NOTIFY_CLOSED == toe)
+ {
num_disconnects++;
+#ifdef _DEBUG
+ fprintf (stderr, "MHD: Connection has closed.\n");
+#endif /* _DEBUG */
+ }
else
abort ();
}
@@ -163,17 +172,21 @@ test_tls_session_time_out (gnutls_session_t session,
uint16_t port)
return 2;
}
- _MHD_sleep (TIME_OUT * 1000 + 1200);
+ _MHD_sleep (timeout_val * 1000 + 1700);
+ if (0 == num_connects)
+ {
+ fprintf (stderr, "MHD has not detected any connection attempt.\n");
+ MHD_socket_close_chk_ (sd);
+ return 4;
+ }
/* check that server has closed the connection */
- if (1 == num_disconnects)
+ if (0 == num_disconnects)
{
- fprintf (stderr, "Connection failed to time-out\n");
+ fprintf (stderr, "MHD has not detected any disconnections.\n");
MHD_socket_close_chk_ (sd);
return 1;
}
- else if (0 != num_disconnects)
- abort ();
MHD_socket_close_chk_ (sd);
return 0;
@@ -225,7 +238,9 @@ main (int argc, char *const *argv)
| MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS
| MHD_USE_ERROR_LOG, port,
NULL, NULL, &http_dummy_ahc, NULL,
- MHD_OPTION_CONNECTION_TIMEOUT, TIME_OUT,
+ MHD_OPTION_CONNECTION_TIMEOUT,
+ (unsigned int) timeout_val,
+ MHD_OPTION_NOTIFY_CONNECTION, &socket_cb, NULL,
MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem,
MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem,
MHD_OPTION_END);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (30ef790c -> c930fe1a), gnunet, 2022/10/10
- [libmicrohttpd] 04/31: testcurl/https: stopped CA file creation/removal, gnunet, 2022/10/10
- [libmicrohttpd] 05/31: testcurl/https: removed explicit cipher setting, gnunet, 2022/10/10
- [libmicrohttpd] 01/31: Removed curl_version_check, gnunet, 2022/10/10
- [libmicrohttpd] 07/31: test_https_session_info: fixed compiler warning with old libcurl, gnunet, 2022/10/10
- [libmicrohttpd] 12/31: test_https_time_out: second attempt to really check something with this test,
gnunet <=
- [libmicrohttpd] 02/31: testcurl/https: fixed functions declarations, gnunet, 2022/10/10
- [libmicrohttpd] 03/31: testcurl/https: fixed compiler warnings, wrong types, gnunet, 2022/10/10
- [libmicrohttpd] 06/31: testcurl/https: do not enforce TLSv1, gnunet, 2022/10/10
- [libmicrohttpd] 08/31: testcurl/https: removed usage of deprecated libcurl parameter, gnunet, 2022/10/10
- [libmicrohttpd] 10/31: test_https_get_parallel{,_threads}: removed artificial delay, gnunet, 2022/10/10
- [libmicrohttpd] 13/31: MHD_start_daemon(): minor readability improvement, gnunet, 2022/10/10
- [libmicrohttpd] 14/31: microhttpd.h: improved doxy for MHD_USE_THREAD_PER_CONNECTION, gnunet, 2022/10/10
- [libmicrohttpd] 15/31: MHD_run_wait(): improved readability, gnunet, 2022/10/10
- [libmicrohttpd] 11/31: daemon: fixed delayed notification callback in thread-per-connection mode, gnunet, 2022/10/10
- [libmicrohttpd] 16/31: daemon: small refactoring for more compact code when poll() is not supported, gnunet, 2022/10/10