gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (d14fc3b3 -> 0effaaad)


From: gnunet
Subject: [libmicrohttpd] branch master updated (d14fc3b3 -> 0effaaad)
Date: Thu, 28 Apr 2022 18:09:43 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from d14fc3b3 MHD_get_timeout*(): improved doxy
     new d147ab19 response: fixed copy-paste error introduced by 
b8e13a57a0035f1f416d593d64115bd4417c2028
     new aea4dcae test_response_entries: improved error print
     new c6eae238 Added new function MHD_get_timeout_i()
     new ba77b04c Replaced calls of MHD_get_timeout() in tests and examples
     new 0effaaad digestauth: moved "hash" calculation to separate function

The 5 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:
 doc/examples/sessions.c                           |  4 +-
 src/examples/fileserver_example_external_select.c |  6 +--
 src/examples/post_example.c                       |  4 +-
 src/examples/suspend_resume_epoll.c               | 12 +----
 src/include/microhttpd.h                          | 52 +++++++++++++++++--
 src/microhttpd/daemon.c                           | 62 +++++++++++++++++++++--
 src/microhttpd/digestauth.c                       | 40 +++++++++++----
 src/microhttpd/response.c                         |  3 +-
 src/microhttpd/test_client_put_stop.c             |  3 +-
 src/microhttpd/test_response_entries.c            |  6 +--
 src/microhttpd/test_set_panic.c                   |  3 +-
 src/microhttpd/test_upgrade.c                     | 32 ++++++------
 src/microhttpd/test_upgrade_large.c               | 32 ++++++------
 src/testcurl/perf_get_concurrent.c                | 10 ++--
 src/testcurl/test_get_close_keep_alive.c          |  3 +-
 src/testcurl/test_post_loop.c                     | 16 +++---
 src/testcurl/test_toolarge.c                      |  3 +-
 src/testcurl/test_tricky.c                        |  3 +-
 18 files changed, 201 insertions(+), 93 deletions(-)

diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c
index 0c8e5114..9b36c485 100644
--- a/doc/examples/sessions.c
+++ b/doc/examples/sessions.c
@@ -742,7 +742,7 @@ main (int argc, char *const *argv)
   fd_set ws;
   fd_set es;
   MHD_socket max;
-  MHD_UNSIGNED_LONG_LONG mhd_timeout;
+  uint64_t mhd_timeout;
 
   if (argc != 2)
   {
@@ -770,7 +770,7 @@ main (int argc, char *const *argv)
     FD_ZERO (&es);
     if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
       break; /* fatal internal error */
-    if (MHD_get_timeout (d, &mhd_timeout) == MHD_YES)
+    if (MHD_get_timeout64 (d, &mhd_timeout) == MHD_YES)
     {
       tv.tv_sec = mhd_timeout / 1000;
       tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000)) * 1000;
diff --git a/src/examples/fileserver_example_external_select.c 
b/src/examples/fileserver_example_external_select.c
index cdd455ec..3c077413 100644
--- a/src/examples/fileserver_example_external_select.c
+++ b/src/examples/fileserver_example_external_select.c
@@ -134,7 +134,7 @@ main (int argc, char *const *argv)
   fd_set ws;
   fd_set es;
   MHD_socket max;
-  MHD_UNSIGNED_LONG_LONG mhd_timeout;
+  uint64_t mhd_timeout;
 
   if (argc != 3)
   {
@@ -157,9 +157,9 @@ main (int argc, char *const *argv)
     FD_ZERO (&es);
     if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
       break; /* fatal internal error */
-    if (MHD_get_timeout (d, &mhd_timeout) == MHD_YES)
+    if (MHD_get_timeout64 (d, &mhd_timeout) == MHD_YES)
     {
-      if (((MHD_UNSIGNED_LONG_LONG) tv.tv_sec) < mhd_timeout / 1000LL)
+      if (((uint64_t) tv.tv_sec) < mhd_timeout / 1000LL)
       {
         tv.tv_sec = mhd_timeout / 1000LL;
         tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000LL)) * 1000LL;
diff --git a/src/examples/post_example.c b/src/examples/post_example.c
index 1134a331..709fc918 100644
--- a/src/examples/post_example.c
+++ b/src/examples/post_example.c
@@ -733,7 +733,7 @@ main (int argc, char *const *argv)
   fd_set ws;
   fd_set es;
   MHD_socket max;
-  MHD_UNSIGNED_LONG_LONG mhd_timeout;
+  uint64_t mhd_timeout;
 
   if (argc != 2)
   {
@@ -761,7 +761,7 @@ main (int argc, char *const *argv)
     FD_ZERO (&es);
     if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
       break; /* fatal internal error */
-    if (MHD_get_timeout (d, &mhd_timeout) == MHD_YES)
+    if (MHD_get_timeout64 (d, &mhd_timeout) == MHD_YES)
     {
       tv.tv_sec = mhd_timeout / 1000;
       tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000)) * 1000;
diff --git a/src/examples/suspend_resume_epoll.c 
b/src/examples/suspend_resume_epoll.c
index b63f80be..87ec6521 100644
--- a/src/examples/suspend_resume_epoll.c
+++ b/src/examples/suspend_resume_epoll.c
@@ -174,16 +174,8 @@ main (int argc,
 
   while (1)
   {
-    int timeout;
-    MHD_UNSIGNED_LONG_LONG to;
-
-    if (MHD_YES !=
-        MHD_get_timeout (d,
-                         &to))
-      timeout = TIMEOUT_INFINITE;
-    else
-      timeout = (to < INT_MAX - 1) ? (int) to : (INT_MAX - 1);
-    current_event_count = epoll_wait (epfd, events_list, 1, timeout);
+    current_event_count = epoll_wait (epfd, events_list, 1,
+                                      MHD_get_timeout_i (d));
 
     if (1 == current_event_count)
     {
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 0563e907..8f89eba0 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -96,7 +96,7 @@ extern "C"
  * they are parsed as decimal numbers.
  * Example: 0x01093001 = 1.9.30-1.
  */
-#define MHD_VERSION 0x00097509
+#define MHD_VERSION 0x00097510
 
 /* If generic headers don't work on your platform, include headers
    which define 'va_list', 'size_t', 'ssize_t', 'intptr_t',
@@ -2903,7 +2903,8 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
  * connections with data pending in network buffers and other problems.
  *
  * It is important to always use this function (or #MHD_get_timeout64(),
- * #MHD_get_timeout64s() functions) when "external" polling is used.
+ * #MHD_get_timeout64s(), #MHD_get_timeout_i() functions) when "external"
+ * polling is used.
  * If this function returns #MHD_YES then #MHD_run() (or 
#MHD_run_from_select())
  * must be called right after return from polling function, regardless of
  * the states of MHD FDs.
@@ -2939,7 +2940,8 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
  * connections with data pending in network buffers and other problems.
  *
  * It is important to always use this function (or #MHD_get_timeout(),
- * #MHD_get_timeout64s() functions) when "external" polling is used.
+ * #MHD_get_timeout64s(), #MHD_get_timeout_i() functions) when "external"
+ * polling is used.
  * If this function returns #MHD_YES then #MHD_run() (or 
#MHD_run_from_select())
  * must be called right after return from polling function, regardless of
  * the states of MHD FDs.
@@ -2978,7 +2980,8 @@ MHD_get_timeout64 (struct MHD_Daemon *daemon,
  * network buffers and other problems.
  *
  * It is important to always use this function (or #MHD_get_timeout(),
- * #MHD_get_timeout64() functions) when "external" polling is used.
+ * #MHD_get_timeout64(), #MHD_get_timeout_i() functions) when "external"
+ * polling is used.
  * If this function returns non-negative value then #MHD_run() (or
  * #MHD_run_from_select()) must be called right after return from polling
  * function, regardless of the states of MHD FDs.
@@ -3001,6 +3004,47 @@ _MHD_EXTERN int64_t
 MHD_get_timeout64s (struct MHD_Daemon *daemon);
 
 
+/**
+ * Obtain timeout value for external polling function for this daemon.
+ *
+ * This function set value to the amount of milliseconds for which polling
+ * function (`select()`, `poll()` or epoll) should at most block, not the
+ * timeout value set for connections.
+ *
+ * Any "external" sockets polling function must be called with the timeout
+ * value provided by this function (if returned value is non-negative).
+ * Smaller timeout values can be used for polling function if it is required
+ * for any reason, but using larger timeout value or no timeout (indefinite
+ * timeout) when this function returns non-negative value will break MHD
+ * processing logic and result in "hung" connections with data pending in
+ * network buffers and other problems.
+ *
+ * It is important to always use this function (or #MHD_get_timeout(),
+ * #MHD_get_timeout64(), #MHD_get_timeout64s() functions) when "external"
+ * polling is used.
+ * If this function returns non-negative value then #MHD_run() (or
+ * #MHD_run_from_select()) must be called right after return from polling
+ * function, regardless of the states of MHD FDs.
+ *
+ * In practice, if zero or positive value is returned then #MHD_run() (or
+ * #MHD_run_from_select()) must be called not later than returned amount of
+ * millisecond even if no activity is detected on sockets by sockets
+ * polling function.
+ *
+ * @param daemon the daemon to query for timeout
+ * @return -1 if connections' timeouts are not set and no data processing
+ *         is pending, so external polling function may wait for sockets
+ *         activity for indefinite amount of time,
+ *         otherwise returned value is the the maximum amount of millisecond
+ *         (capped at INT_MAX) that external polling function must wait
+ *         for the activity of FDs.
+ * @note Available since #MHD_VERSION 0x00097510
+ * @ingroup event
+ */
+_MHD_EXTERN int
+MHD_get_timeout_i (struct MHD_Daemon *daemon);
+
+
 /**
  * Run webserver operations (without blocking unless in client callbacks).
  *
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 4e349206..65529b3c 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -3896,7 +3896,8 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
  * connections with data pending in network buffers and other problems.
  *
  * It is important to always use this function (or #MHD_get_timeout64(),
- * #MHD_get_timeout64s() functions) when "external" polling is used.
+ * #MHD_get_timeout64s(), #MHD_get_timeout_i() functions) when "external"
+ * polling is used.
  * If this function returns #MHD_YES then #MHD_run() (or 
#MHD_run_from_select())
  * must be called right after return from polling function, regardless of
  * the states of MHD FDs.
@@ -3947,7 +3948,8 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
  * connections with data pending in network buffers and other problems.
  *
  * It is important to always use this function (or #MHD_get_timeout(),
- * #MHD_get_timeout64s() functions) when "external" polling is used.
+ * #MHD_get_timeout64s(), #MHD_get_timeout_i() functions) when "external"
+ * polling is used.
  * If this function returns #MHD_YES then #MHD_run() (or 
#MHD_run_from_select())
  * must be called right after return from polling function, regardless of
  * the states of MHD FDs.
@@ -4058,7 +4060,8 @@ MHD_get_timeout64 (struct MHD_Daemon *daemon,
  * network buffers and other problems.
  *
  * It is important to always use this function (or #MHD_get_timeout(),
- * #MHD_get_timeout64() functions) when "external" polling is used.
+ * #MHD_get_timeout64(), #MHD_get_timeout_i() functions) when "external"
+ * polling is used.
  * If this function returns non-negative value then #MHD_run() (or
  * #MHD_run_from_select()) must be called right after return from polling
  * function, regardless of the states of MHD FDs.
@@ -4092,6 +4095,59 @@ MHD_get_timeout64s (struct MHD_Daemon *daemon)
 }
 
 
+/**
+ * Obtain timeout value for external polling function for this daemon.
+ *
+ * This function set value to the amount of milliseconds for which polling
+ * function (`select()`, `poll()` or epoll) should at most block, not the
+ * timeout value set for connections.
+ *
+ * Any "external" sockets polling function must be called with the timeout
+ * value provided by this function (if returned value is non-negative).
+ * Smaller timeout values can be used for polling function if it is required
+ * for any reason, but using larger timeout value or no timeout (indefinite
+ * timeout) when this function returns non-negative value will break MHD
+ * processing logic and result in "hung" connections with data pending in
+ * network buffers and other problems.
+ *
+ * It is important to always use this function (or #MHD_get_timeout(),
+ * #MHD_get_timeout64(), #MHD_get_timeout64s() functions) when "external"
+ * polling is used.
+ * If this function returns non-negative value then #MHD_run() (or
+ * #MHD_run_from_select()) must be called right after return from polling
+ * function, regardless of the states of MHD FDs.
+ *
+ * In practice, if zero or positive value is returned then #MHD_run() (or
+ * #MHD_run_from_select()) must be called not later than returned amount of
+ * millisecond even if no activity is detected on sockets by sockets
+ * polling function.
+ * @remark To be called only from thread that process
+ * daemon's select()/poll()/etc.
+ *
+ * @param daemon the daemon to query for timeout
+ * @return -1 if connections' timeouts are not set and no data processing
+ *         is pending, so external polling function may wait for sockets
+ *         activity for indefinite amount of time,
+ *         otherwise returned value is the the maximum amount of millisecond
+ *         (capped at INT_MAX) that external polling function must wait
+ *         for the activity of FDs.
+ * @note Available since #MHD_VERSION 0x00097510
+ * @ingroup event
+ */
+_MHD_EXTERN int
+MHD_get_timeout_i (struct MHD_Daemon *daemon)
+{
+#if SIZEOF_INT >= SIZEOF_INT64_T
+  return MHD_get_timeout64s (daemon);
+#else  /* SIZEOF_INT < SIZEOF_INT64_T */
+  const int64_t to64 = MHD_get_timeout64s (daemon);
+  if (INT_MAX >= to64)
+    return to64;
+  return INT_MAX;
+#endif /* SIZEOF_INT < SIZEOF_INT64_T */
+}
+
+
 /**
  * Obtain timeout value for polling function for this daemon.
  * @remark To be called only from the thread that processes
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index b40e1fc2..25cae280 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -31,6 +31,7 @@
 #include "mhd_mono_clock.h"
 #include "mhd_str.h"
 #include "mhd_compat.h"
+#include "mhd_bithelpers.h"
 #include "mhd_assert.h"
 
 #if defined(MHD_W32_MUTEX_)
@@ -503,6 +504,33 @@ lookup_sub_value (char *dest,
 }
 
 
+/**
+ * Super-fast xor-based "hash" function
+ *
+ * @param data the data to calculate hash for
+ * @param data_size the size of the data in bytes
+ * @return the "hash"
+ */
+static uint32_t
+fast_simple_hash (const uint8_t *data,
+                  size_t data_size)
+{
+  uint32_t hash;
+
+  if (0 != data_size)
+  {
+    size_t i;
+    hash = data[0];
+    for (i = 1; i < data_size; i++)
+      hash = _MHD_ROTL32 (hash, 8) ^ data[i];
+  }
+  else
+    hash = 0;
+
+  return hash;
+}
+
+
 /**
  * Check nonce-nc map array with either new nonce counter
  * or a whole new nonce.
@@ -521,7 +549,6 @@ check_nonce_nc (struct MHD_Connection *connection,
   struct MHD_NonceNc *nn;
   uint32_t off;
   uint32_t mod;
-  const char *np;
   size_t noncelen;
   enum MHD_Result ret;
   bool stale;
@@ -536,15 +563,8 @@ check_nonce_nc (struct MHD_Connection *connection,
   mod = daemon->nonce_nc_size;
   if (0 == mod)
     return MHD_NO; /* no array! */
-  /* super-fast xor-based "hash" function for HT lookup in nonce array */
-  off = 0;
-  np = nonce;
-  while ('\0' != *np)
-  {
-    off = (off << 8) | (((uint8_t) *np) ^ (off >> 24));
-    np++;
-  }
-  off = off % mod;
+  /* HT lookup in nonce array */
+  off = fast_simple_hash ((const uint8_t *) nonce, noncelen) % mod;
   /*
    * Look for the nonce, if it does exist and its corresponding
    * nonce counter is less than the current nonce counter by 1,
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index fd3cd192..65158819 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -274,7 +274,8 @@ add_response_header_connection (struct MHD_Response 
*response,
     mhd_assert (0 <= norm_len_s);
     if (0 > norm_len_s)
       norm_len = 0; /* Must never happen */
-    norm_len = (size_t) norm_len;
+    else
+      norm_len = (size_t) norm_len_s;
   }
 #ifdef UPGRADE_SUPPORT
   if ( (NULL != response->upgrade_handler) && value_has_close)
diff --git a/src/microhttpd/test_client_put_stop.c 
b/src/microhttpd/test_client_put_stop.c
index 09845ff9..dfd6af2e 100644
--- a/src/microhttpd/test_client_put_stop.c
+++ b/src/microhttpd/test_client_put_stop.c
@@ -1408,10 +1408,9 @@ performQueryExternal (struct MHD_Daemon *d, struct 
_MHD_dumbClient *clnt)
     {
       /* client has finished, check whether MHD is still
        * processing any connections */
-      unsigned long long to;
       full_req_sent = 1;
       do_client = 0;
-      if (client_accepted && (MHD_YES != MHD_get_timeout (d, &to)))
+      if (client_accepted && (0 > MHD_get_timeout64s (d)))
       {
         ret = 0;
         break; /* MHD finished as well */
diff --git a/src/microhttpd/test_response_entries.c 
b/src/microhttpd/test_response_entries.c
index c08466df..5386b8da 100644
--- a/src/microhttpd/test_response_entries.c
+++ b/src/microhttpd/test_response_entries.c
@@ -24,21 +24,21 @@ expect_str (const char *actual, const char *expected)
   if (NULL == actual)
   {
     fprintf (stderr, "FAILED: result: NULL\n" \
-             "        expected: \"%s\"",
+             "        expected: \"%s\"\n",
              expected);
     return 0;
   }
   if (NULL == expected)
   {
     fprintf (stderr, "FAILED: result: \"%s\"\n" \
-             "        expected: NULL",
+             "        expected: NULL\n",
              actual);
     return 0;
   }
   if (0 != strcmp (actual, expected))
   {
     fprintf (stderr, "FAILED: result: \"%s\"\n" \
-             "        expected: \"%s\"",
+             "        expected: \"%s\"\n",
              actual, expected);
     return 0;
   }
diff --git a/src/microhttpd/test_set_panic.c b/src/microhttpd/test_set_panic.c
index 2d81c620..b1a24000 100644
--- a/src/microhttpd/test_set_panic.c
+++ b/src/microhttpd/test_set_panic.c
@@ -1179,10 +1179,9 @@ performQueryExternal (struct MHD_Daemon *d, struct 
_MHD_dumbClient *clnt)
     {
       /* client has finished, check whether MHD is still
        * processing any connections */
-      unsigned long long to;
       full_req_sent = 1;
       do_client = 0;
-      if (client_accepted && (MHD_YES != MHD_get_timeout (d, &to)))
+      if (client_accepted && (0 > MHD_get_timeout64s (d)))
       {
         ret = 0;
         break; /* MHD finished as well */
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c
index 2ade5edd..5ceb6466 100644
--- a/src/microhttpd/test_upgrade.c
+++ b/src/microhttpd/test_upgrade.c
@@ -1095,7 +1095,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
   fd_set ws;
   fd_set es;
   MHD_socket max_fd;
-  MHD_UNSIGNED_LONG_LONG to;
+  uint64_t to64;
   struct timeval tv;
 
   while (! done)
@@ -1104,7 +1104,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
     FD_ZERO (&ws);
     FD_ZERO (&es);
     max_fd = MHD_INVALID_SOCKET;
-    to = 1000;
+    to64 = 1000;
 
     if (MHD_YES !=
         MHD_get_fdset (daemon,
@@ -1113,12 +1113,12 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
                        &es,
                        &max_fd))
       mhdErrorExitDesc ("MHD_get_fdset() failed");
-    (void) MHD_get_timeout (daemon,
-                            &to);
-    if (1000 < to)
-      to = 1000;
-    tv.tv_sec = to / 1000;
-    tv.tv_usec = 1000 * (to % 1000);
+    (void) MHD_get_timeout64 (daemon,
+                              &to64);
+    if (1000 < to64)
+      to64 = 1000;
+    tv.tv_sec = to64 / 1000;
+    tv.tv_usec = 1000 * (to64 % 1000);
     if (0 > MHD_SYS_select_ (max_fd + 1,
                              &rs,
                              &ws,
@@ -1173,7 +1173,7 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
   const union MHD_DaemonInfo *di;
   MHD_socket ep;
   fd_set rs;
-  MHD_UNSIGNED_LONG_LONG to;
+  uint64_t to64;
   struct timeval tv;
   int ret;
 
@@ -1185,15 +1185,15 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
   while (! done)
   {
     FD_ZERO (&rs);
-    to = 1000;
+    to64 = 1000;
 
     FD_SET (ep, &rs);
-    (void) MHD_get_timeout (daemon,
-                            &to);
-    if (1000 < to)
-      to = 1000;
-    tv.tv_sec = to / 1000;
-    tv.tv_usec = 1000 * (to % 1000);
+    (void) MHD_get_timeout64 (daemon,
+                              &to64);
+    if (1000 < to64)
+      to64 = 1000;
+    tv.tv_sec = to64 / 1000;
+    tv.tv_usec = 1000 * (to64 % 1000);
     ret = select (ep + 1,
                   &rs,
                   NULL,
diff --git a/src/microhttpd/test_upgrade_large.c 
b/src/microhttpd/test_upgrade_large.c
index 83ab50ca..312a3448 100644
--- a/src/microhttpd/test_upgrade_large.c
+++ b/src/microhttpd/test_upgrade_large.c
@@ -1278,7 +1278,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
   fd_set ws;
   fd_set es;
   MHD_socket max_fd;
-  MHD_UNSIGNED_LONG_LONG to;
+  uint64_t to64;
   struct timeval tv;
 
   while (! done)
@@ -1287,7 +1287,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
     FD_ZERO (&ws);
     FD_ZERO (&es);
     max_fd = MHD_INVALID_SOCKET;
-    to = 1000;
+    to64 = 1000;
 
     FD_SET (MHD_itc_r_fd_ (kicker), &rs);
     if (MHD_YES !=
@@ -1297,12 +1297,12 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
                        &es,
                        &max_fd))
       mhdErrorExitDesc ("MHD_get_fdset() failed");
-    (void) MHD_get_timeout (daemon,
-                            &to);
-    if (1000 < to)
-      to = 1000;
-    tv.tv_sec = to / 1000;
-    tv.tv_usec = 1000 * (to % 1000);
+    (void) MHD_get_timeout64 (daemon,
+                              &to64);
+    if (1000 < to64)
+      to64 = 1000;
+    tv.tv_sec = to64 / 1000;
+    tv.tv_usec = 1000 * (to64 % 1000);
     if (0 > MHD_SYS_select_ (max_fd + 1,
                              &rs,
                              &ws,
@@ -1359,7 +1359,7 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
   const union MHD_DaemonInfo *di;
   MHD_socket ep;
   fd_set rs;
-  MHD_UNSIGNED_LONG_LONG to;
+  uint64_t to64;
   struct timeval tv;
   int ret;
 
@@ -1371,15 +1371,15 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
   while (! done)
   {
     FD_ZERO (&rs);
-    to = 1000;
+    to64 = 1000;
     FD_SET (MHD_itc_r_fd_ (kicker), &rs);
     FD_SET (ep, &rs);
-    (void) MHD_get_timeout (daemon,
-                            &to);
-    if (1000 < to)
-      to = 1000;
-    tv.tv_sec = to / 1000;
-    tv.tv_usec = 1000 * (to % 1000);
+    (void) MHD_get_timeout64 (daemon,
+                              &to64);
+    if (1000 < to64)
+      to64 = 1000;
+    tv.tv_sec = to64 / 1000;
+    tv.tv_usec = 1000 * (to64 % 1000);
     ret = select (ep + 1,
                   &rs,
                   NULL,
diff --git a/src/testcurl/perf_get_concurrent.c 
b/src/testcurl/perf_get_concurrent.c
index ea282874..80f66eea 100644
--- a/src/testcurl/perf_get_concurrent.c
+++ b/src/testcurl/perf_get_concurrent.c
@@ -413,7 +413,7 @@ testExternalGet (int port)
   fd_set es;
   MHD_socket max;
   struct timeval tv;
-  MHD_UNSIGNED_LONG_LONG tt;
+  uint64_t tt64;
   int tret;
   char *ret_val;
   int ret = 0;
@@ -455,11 +455,11 @@ testExternalGet (int port)
       MHD_stop_daemon (d);
       return 4096;
     }
-    tret = MHD_get_timeout (d, &tt);
+    tret = MHD_get_timeout64 (d, &tt64);
     if (MHD_YES != tret)
-      tt = 1;
-    tv.tv_sec = tt / 1000;
-    tv.tv_usec = 1000 * (tt % 1000);
+      tt64 = 1;
+    tv.tv_sec = tt64 / 1000;
+    tv.tv_usec = 1000 * (tt64 % 1000);
     if (-1 == select (max + 1, &rs, &ws, &es, &tv))
     {
 #ifdef MHD_POSIX_SOCKETS
diff --git a/src/testcurl/test_get_close_keep_alive.c 
b/src/testcurl/test_get_close_keep_alive.c
index 8f83fa1d..7857f2ad 100644
--- a/src/testcurl/test_get_close_keep_alive.c
+++ b/src/testcurl/test_get_close_keep_alive.c
@@ -562,8 +562,7 @@ performQueryExternal (struct MHD_Daemon *d, CURL *c)
     }
     if (NULL == multi)
     { /* libcurl has finished, check whether MHD still needs to perform 
cleanup */
-      unsigned long long to;
-      if ((MHD_YES != MHD_get_timeout (d, &to)) || (0 != to))
+      if (0 != MHD_get_timeout64s (d))
         break; /* MHD finished as well */
     }
     if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxMhdSk))
diff --git a/src/testcurl/test_post_loop.c b/src/testcurl/test_post_loop.c
index c36fba7f..37cd121b 100644
--- a/src/testcurl/test_post_loop.c
+++ b/src/testcurl/test_post_loop.c
@@ -413,7 +413,7 @@ testExternalPost ()
   time_t start;
   struct timeval tv;
   int i;
-  unsigned long long timeout;
+  uint64_t timeout64;
   long ctimeout;
   char url[1024];
   int port;
@@ -516,15 +516,15 @@ testExternalPost ()
         MHD_stop_daemon (d);
         return 4096;
       }
-      if (MHD_NO == MHD_get_timeout (d, &timeout))
-        timeout = 100;          /* 100ms == INFTY -- CURL bug... */
+      if (MHD_NO == MHD_get_timeout64 (d, &timeout64))
+        timeout64 = 100;          /* 100ms == INFTY -- CURL bug... */
       if ((CURLM_OK == curl_multi_timeout (multi, &ctimeout)) &&
-          (ctimeout < (long long) timeout) && (ctimeout >= 0))
-        timeout = ctimeout;
+          (ctimeout >= 0) && ((uint64_t) ctimeout < timeout64))
+        timeout64 = (uint64_t) ctimeout;
       if ( (c == NULL) || (0 == running) )
-        timeout = 0; /* terminate quickly... */
-      tv.tv_sec = timeout / 1000;
-      tv.tv_usec = (timeout % 1000) * 1000;
+        timeout64 = 0; /* terminate quickly... */
+      tv.tv_sec = timeout64 / 1000;
+      tv.tv_usec = (timeout64 % 1000) * 1000;
       if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv))
       {
 #ifdef MHD_POSIX_SOCKETS
diff --git a/src/testcurl/test_toolarge.c b/src/testcurl/test_toolarge.c
index d8bfaef6..42ea471f 100644
--- a/src/testcurl/test_toolarge.c
+++ b/src/testcurl/test_toolarge.c
@@ -661,8 +661,7 @@ performQueryExternal (struct MHD_Daemon *d, CURL *c)
     }
     if (NULL == multi)
     { /* libcurl has finished, check whether MHD still needs to perform 
cleanup */
-      unsigned long long to;
-      if ((MHD_YES != MHD_get_timeout (d, &to)) || (0 != to))
+      if (0 != MHD_get_timeout64s (d))
         break; /* MHD finished as well */
     }
     if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxMhdSk))
diff --git a/src/testcurl/test_tricky.c b/src/testcurl/test_tricky.c
index 1aca7dce..5bc28323 100644
--- a/src/testcurl/test_tricky.c
+++ b/src/testcurl/test_tricky.c
@@ -591,8 +591,7 @@ performQueryExternal (struct MHD_Daemon *d, CURL *c)
     }
     if (NULL == multi)
     { /* libcurl has finished, check whether MHD still needs to perform 
cleanup */
-      unsigned long long to;
-      if ((MHD_YES != MHD_get_timeout (d, &to)) || (0 != to))
+      if (0 != MHD_get_timeout64s (d))
         break; /* MHD finished as well */
     }
     if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxMhdSk))

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