gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 01/03: test_https_time_out: fixed test, now testing is r


From: gnunet
Subject: [libmicrohttpd] 01/03: test_https_time_out: fixed test, now testing is real
Date: Sun, 12 Dec 2021 18:52:47 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 54e83ba5ee023873390e84b11bb6abddc6e4e373
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun Dec 12 20:03:43 2021 +0300

    test_https_time_out: fixed test, now testing is real
---
 src/testcurl/https/test_https_time_out.c | 33 +++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/src/testcurl/https/test_https_time_out.c 
b/src/testcurl/https/test_https_time_out.c
index e77c8c66..c86aaccd 100644
--- a/src/testcurl/https/test_https_time_out.c
+++ b/src/testcurl/https/test_https_time_out.c
@@ -44,7 +44,33 @@
 extern const char srv_key_pem[];
 extern const char srv_self_signed_cert_pem[];
 
-static const int TIME_OUT = 3;
+static const int TIME_OUT = 2;
+
+static unsigned int num_connects = 0;
+static unsigned int num_disconnects = 0;
+
+void
+socket_cb (void *cls,
+           struct MHD_Connection *c,
+           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)
+    abort ();
+
+  if (MHD_CONNECTION_NOTIFY_STARTED == toe)
+    num_connects++;
+  else if (MHD_CONNECTION_NOTIFY_CLOSED == toe)
+    num_disconnects++;
+  else
+    abort ();
+}
+
 
 static int
 test_tls_session_time_out (gnutls_session_t session, int port)
@@ -87,13 +113,14 @@ test_tls_session_time_out (gnutls_session_t session, int 
port)
   (void) sleep (TIME_OUT + 1);
 
   /* check that server has closed the connection */
-  /* TODO better RST trigger */
-  if (send (sd, "", 1, 0) >= 0)
+  if (1 == num_disconnects)
   {
     fprintf (stderr, "Connection failed to time-out\n");
     MHD_socket_close_chk_ (sd);
     return -1;
   }
+  else if (0 != num_disconnects)
+    abort ();
 
   MHD_socket_close_chk_ (sd);
   return 0;

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]