gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 09/09: test_upgrade{, _large}: used the same port for al


From: gnunet
Subject: [libmicrohttpd] 09/09: test_upgrade{, _large}: used the same port for all checks.
Date: Sat, 15 Jan 2022 15:47:49 +0100

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 0ea5d514477a8b109a922afe5cdd1343d94c63bd
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sat Jan 15 17:45:48 2022 +0300

    test_upgrade{,_large}: used the same port for all checks.
    
    Fixed port conflict for platforms with broken detection of autobind port
---
 src/microhttpd/test_upgrade.c       | 14 ++++++++------
 src/microhttpd/test_upgrade_large.c | 14 ++++++++------
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c
index 68598723..fa91f7dc 100644
--- a/src/microhttpd/test_upgrade.c
+++ b/src/microhttpd/test_upgrade.c
@@ -174,6 +174,8 @@ fflush_allstd (void)
 
 static int verbose = 0;
 
+static uint16_t global_port;
+
 enum tls_tool
 {
   TLS_CLI_NO_TOOL = 0,
@@ -1265,9 +1267,7 @@ test_upgrade (int flags,
 
   if (! test_tls)
     d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE,
-                          MHD_is_feature_supported (
-                            MHD_FEATURE_AUTODETECT_BIND_PORT) ?
-                          0 : 1090,
+                          global_port,
                           NULL, NULL,
                           &ahc_upgrade, NULL,
                           MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
@@ -1281,9 +1281,7 @@ test_upgrade (int flags,
   else
     d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE
                           | MHD_USE_TLS,
-                          MHD_is_feature_supported (
-                            MHD_FEATURE_AUTODETECT_BIND_PORT) ?
-                          0 : 1090,
+                          global_port,
                           NULL, NULL,
                           &ahc_upgrade, NULL,
                           MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
@@ -1307,6 +1305,7 @@ test_upgrade (int flags,
   if ( (NULL == dinfo) ||
        (0 == dinfo->port) )
     mhdErrorExitDesc ("MHD_get_daemon_info() failed");
+  global_port = dinfo->port; /* Re-use the same port for the next checks */
   if (! test_tls || (TLS_LIB_GNUTLS == use_tls_tool))
   {
     sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt ();
@@ -1434,6 +1433,9 @@ main (int argc,
 #endif /* ! HTTPS_SUPPORT */
   }
 
+  global_port = MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT) ?
+                0 : (test_tls ? 1091 : 1090);
+
   /* run tests */
   if (verbose)
     printf ("Starting HTTP \"Upgrade\" tests with %s connections.\n",
diff --git a/src/microhttpd/test_upgrade_large.c 
b/src/microhttpd/test_upgrade_large.c
index 7c1032cf..3ccb1985 100644
--- a/src/microhttpd/test_upgrade_large.c
+++ b/src/microhttpd/test_upgrade_large.c
@@ -338,6 +338,8 @@ fflush_allstd (void)
 
 static int verbose = 0;
 
+static uint16_t global_port;
+
 static struct MHD_itc_ kicker = MHD_ITC_STATIC_INIT_INVALID;
 
 enum tls_tool
@@ -1453,9 +1455,7 @@ test_upgrade (int flags,
 
   if (! test_tls)
     d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE,
-                          MHD_is_feature_supported (
-                            MHD_FEATURE_AUTODETECT_BIND_PORT) ?
-                          0 : 1090,
+                          global_port,
                           NULL, NULL,
                           &ahc_upgrade, NULL,
                           MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) 512,
@@ -1470,9 +1470,7 @@ test_upgrade (int flags,
   else
     d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE
                           | MHD_USE_TLS,
-                          MHD_is_feature_supported (
-                            MHD_FEATURE_AUTODETECT_BIND_PORT) ?
-                          0 : 1090,
+                          global_port,
                           NULL, NULL,
                           &ahc_upgrade, NULL,
                           MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) 512,
@@ -1497,6 +1495,7 @@ test_upgrade (int flags,
   if ( (NULL == dinfo) ||
        (0 == dinfo->port) )
     mhdErrorExitDesc ("MHD_get_daemon_info() failed");
+  global_port = dinfo->port; /* Re-use the same port for the next checks */
   if (! test_tls || (TLS_LIB_GNUTLS == use_tls_tool))
   {
     sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt ();
@@ -1634,6 +1633,9 @@ main (int argc,
 #endif /* ! HTTPS_SUPPORT */
   }
 
+  global_port = MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT) ?
+                0 : (test_tls ? 1093 : 1092);
+
   /* run tests */
   if (verbose)
     printf ("Starting HTTP \"Upgrade\" tests with %s connections.\n",

-- 
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]