gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (e0251c6d -> b468b54f)


From: gnunet
Subject: [libmicrohttpd] branch master updated (e0251c6d -> b468b54f)
Date: Sun, 12 Dec 2021 18:06:34 +0100

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from e0251c6d test_get_chunked: follow HTTP specification
     new 8f803e18 https tests: mute compiler warnings for old curl
     new b468b54f test_timeout: avoid busy-waiting

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/testcurl/https/test_https_session_info.c |  3 ++
 src/testcurl/test_timeout.c                  | 42 ++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)

diff --git a/src/testcurl/https/test_https_session_info.c 
b/src/testcurl/https/test_https_session_info.c
index ebafec34..a329e02e 100644
--- a/src/testcurl/https/test_https_session_info.c
+++ b/src/testcurl/https/test_https_session_info.c
@@ -1,6 +1,7 @@
 /*
  This file is part of libmicrohttpd
  Copyright (C) 2007, 2016 Christian Grothoff
+ Copyright (C) 2016-2021 Evgeny Grin (Karlson2k)
 
  libmicrohttpd is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published
@@ -22,6 +23,7 @@
  * @file mhds_session_info_test.c
  * @brief  Testcase for libmicrohttpd HTTPS connection querying operations
  * @author Sagie Amir
+ * @author Karlson2k (Evgeny Grin)
  */
 
 #include "platform.h"
@@ -228,6 +230,7 @@ main (int argc, char *const *argv)
   curl_global_cleanup ();
   return errorCount != 0 ? 1 : 0;
 #else  /* LIBCURL_VERSION_NUM < 0x072200 */
+  (void) argc; (void) argv;   /* Unused. Silent compiler warning. */
   return 77;
 #endif /* LIBCURL_VERSION_NUM < 0x072200 */
 }
diff --git a/src/testcurl/test_timeout.c b/src/testcurl/test_timeout.c
index 8742b9ff..bcc1ad91 100644
--- a/src/testcurl/test_timeout.c
+++ b/src/testcurl/test_timeout.c
@@ -39,6 +39,47 @@
 #include <unistd.h>
 #endif
 
+
+/**
+ * Pause execution for specified number of milliseconds.
+ * @param ms the number of milliseconds to sleep
+ */
+void
+_MHD_sleep (uint32_t ms)
+{
+#if defined(_WIN32)
+  Sleep (ms);
+#elif defined(HAVE_NANOSLEEP)
+  struct timespec slp = {ms / 1000, (ms % 1000) * 1000000};
+  struct timespec rmn;
+  int num_retries = 0;
+  while (0 != nanosleep (&slp, &rmn))
+  {
+    if (EINTR != errno)
+      externalErrorExit ();
+    if (num_retries++ > 8)
+      break;
+    slp = rmn;
+  }
+#elif defined(HAVE_USLEEP)
+  uint64_t us = ms * 1000;
+  do
+  {
+    uint64_t this_sleep;
+    if (999999 < us)
+      this_sleep = 999999;
+    else
+      this_sleep = us;
+    /* Ignore return value as it could be void */
+    usleep (this_sleep);
+    us -= this_sleep;
+  } while (us > 0);
+#else
+  fprintf (stderr, "No sleep function available on this system.\n");
+#endif
+}
+
+
 static int oneone;
 
 static int withTimeout = 0;
@@ -125,6 +166,7 @@ static size_t
 putBuffer_fail (void *stream, size_t size, size_t nmemb, void *ptr)
 {
   (void) stream; (void) size; (void) nmemb; (void) ptr;        /* Unused. 
Silent compiler warning. */
+  _MHD_sleep (100); /* Avoid busy-waiting */
   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]