gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (a8423ab8 -> dca52bf1)


From: gnunet
Subject: [libmicrohttpd] branch master updated (a8423ab8 -> dca52bf1)
Date: Wed, 01 Dec 2021 14:46:09 +0100

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from a8423ab8 configure: do header detection before other checks
     new 969cbdf6 Added missing ifdef guard for <stdbool.h>
     new 3f634541 mhd_sockets: reordered includes for better compatibility
     new 280fb849 Minor readability improvements
     new dca52bf1 test_client_put_stop: don't use fd_sets if select() fails

The 4 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/examples/websocket_threaded_example.c |  6 ++---
 src/microhttpd/daemon.c                   |  2 +-
 src/microhttpd/mhd_sockets.h              | 38 ++++++++++++++++---------------
 src/microhttpd/mhd_threads.h              |  9 ++++----
 src/microhttpd/test_client_put_stop.c     | 11 ++++-----
 5 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/src/examples/websocket_threaded_example.c 
b/src/examples/websocket_threaded_example.c
index 3a232b41..3f94cbd8 100644
--- a/src/examples/websocket_threaded_example.c
+++ b/src/examples/websocket_threaded_example.c
@@ -420,9 +420,9 @@ is_websocket_request (struct MHD_Connection *con, const 
char *upg_header,
 
   (void) con;  /* Unused. Silent compiler warning. */
 
-  return (upg_header != NULL) && (con_header != NULL)
-         && (0 == strcmp (upg_header, WS_UPGRADE_VALUE))
-         && (NULL != strstr (con_header, "Upgrade"))
+  return ((upg_header != NULL) && (con_header != NULL)
+          && (0 == strcmp (upg_header, WS_UPGRADE_VALUE))
+          && (NULL != strstr (con_header, "Upgrade")))
          ? MHD_YES
          : MHD_NO;
 }
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 25ac0969..9731bf72 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2157,7 +2157,7 @@ thread_main_handle_connection (void *data)
 #else
                          1,
 #endif
-                         (NULL == tvp) ? -1 : tv.tv_sec * 1000) < 0)
+                         (NULL == tvp) ? -1 : (tv.tv_sec * 1000)) < 0)
       {
         if (MHD_SCKT_LAST_ERR_IS_ (MHD_SCKT_EINTR_))
           continue;
diff --git a/src/microhttpd/mhd_sockets.h b/src/microhttpd/mhd_sockets.h
index 35fdf6b4..9ff2e372 100644
--- a/src/microhttpd/mhd_sockets.h
+++ b/src/microhttpd/mhd_sockets.h
@@ -35,11 +35,21 @@
 #include "mhd_options.h"
 
 #include <errno.h>
+#ifdef HAVE_STDBOOL_H
 #include <stdbool.h>
+#endif /* HAVE_STDBOOL_H */
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif /* HAVE_UNISTD_H */
 #include <fcntl.h>
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif /* HAVE_STDDEF_H */
+#if defined(_MSC_FULL_VER) && ! defined (_SSIZE_T_DEFINED)
+#  include <stdint.h>
+#  define _SSIZE_T_DEFINED
+typedef intptr_t ssize_t;
+#endif /* !_SSIZE_T_DEFINED */
 
 #if ! defined(MHD_POSIX_SOCKETS) && ! defined(MHD_WINSOCK_SOCKETS)
 #  if ! defined(_WIN32) || defined(__CYGWIN__)
@@ -60,17 +70,26 @@
 #  ifdef HAVE_SYS_TYPES_H
 #    include <sys/types.h> /* required on old platforms */
 #  endif
+#  ifdef HAVE_SYS_TIME_H
+#    include <sys/time.h>
+#  endif
+#  ifdef HAVE_TIME_H
+#    include <time.h>
+#  endif
+#  ifdef HAVE_STRING_H
+#    include <string.h> /* for strerror() */
+#  endif
 #  ifdef HAVE_SYS_SOCKET_H
 #    include <sys/socket.h>
 #  endif
 #  if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS)
+#    include <strings.h>  /* required for FD_SET (bzero() function) */
 #    ifdef HAVE_SOCKLIB_H
 #      include <sockLib.h>
 #    endif /* HAVE_SOCKLIB_H */
 #    ifdef HAVE_INETLIB_H
 #      include <inetLib.h>
 #    endif /* HAVE_INETLIB_H */
-#    include <strings.h>  /* required for FD_SET (bzero() function) */
 #  endif /* __VXWORKS__ || __vxworks || OS_VXWORKS */
 #  ifdef HAVE_NETINET_IN_H
 #    include <netinet/in.h>
@@ -81,12 +100,6 @@
 #  ifdef HAVE_NET_IF_H
 #    include <net/if.h>
 #  endif
-#  ifdef HAVE_SYS_TIME_H
-#    include <sys/time.h>
-#  endif
-#  ifdef HAVE_TIME_H
-#    include <time.h>
-#  endif
 #  ifdef HAVE_NETDB_H
 #    include <netdb.h>
 #  endif
@@ -100,9 +113,6 @@
 /* for TCP_FASTOPEN and TCP_CORK */
 #    include <netinet/tcp.h>
 #  endif
-#  ifdef HAVE_STRING_H
-#    include <string.h> /* for strerror() */
-#  endif
 #elif defined(MHD_WINSOCK_SOCKETS)
 #  ifndef WIN32_LEAN_AND_MEAN
 #    define WIN32_LEAN_AND_MEAN 1
@@ -115,14 +125,6 @@
 #  include <poll.h>
 #endif
 
-#ifdef HAVE_STDDEF_H
-#include <stddef.h>
-#endif /* HAVE_STDDEF_H */
-#if defined(_MSC_FULL_VER) && ! defined (_SSIZE_T_DEFINED)
-#  include <stdint.h>
-#  define _SSIZE_T_DEFINED
-typedef intptr_t ssize_t;
-#endif /* !_SSIZE_T_DEFINED */
 
 #ifdef __FreeBSD__
 #include <sys/param.h> /* For __FreeBSD_version */
diff --git a/src/microhttpd/mhd_threads.h b/src/microhttpd/mhd_threads.h
index 14612ded..818cd5fa 100644
--- a/src/microhttpd/mhd_threads.h
+++ b/src/microhttpd/mhd_threads.h
@@ -150,10 +150,9 @@ typedef struct _MHD_thread_handle_ID_ 
MHD_thread_handle_ID_;
  * @param thread handle to watch
  * @return nonzero on success, zero otherwise
  */
-#define MHD_join_thread_(thread) (WAIT_OBJECT_0 == WaitForSingleObject ( \
-                                    (thread), INFINITE) ? (CloseHandle ( \
-                                                             (thread)), ! 0) : 
\
-                                  0)
+#define MHD_join_thread_(thread) \
+  ( (WAIT_OBJECT_0 == WaitForSingleObject ( (thread), INFINITE)) ? \
+    (CloseHandle ( (thread)), ! 0) : 0 )
 #endif
 
 #if defined(MHD_USE_POSIX_THREADS)
@@ -239,7 +238,7 @@ MHD_create_thread_ (MHD_thread_handle_ID_ *thread,
  */
 int
 MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread,
-                          const char*thread_name,
+                          const char *thread_name,
                           size_t stack_size,
                           MHD_THREAD_START_ROUTINE_ start_routine,
                           void *arg);
diff --git a/src/microhttpd/test_client_put_stop.c 
b/src/microhttpd/test_client_put_stop.c
index 4a6cade0..d5589fd7 100644
--- a/src/microhttpd/test_client_put_stop.c
+++ b/src/microhttpd/test_client_put_stop.c
@@ -824,7 +824,7 @@ _MHD_dumbClient_perform (struct _MHD_dumbClient *clnt)
       maxMhdSk = MHD_INVALID_SOCKET;
       _MHD_dumbClient_get_fdsets (clnt, &maxMhdSk, &rs, &ws, &es);
       mhd_assert (now >= start);
-      tv.tv_sec = TIMEOUTS_VAL - (now - start) + 1;
+      tv.tv_sec = TIMEOUTS_VAL * 2 - (now - start) + 1;
       tv.tv_usec = 250 * 1000;
       if (-1 == select (maxMhdSk + 1, &rs, &ws, &es, &tv))
       {
@@ -836,14 +836,14 @@ _MHD_dumbClient_perform (struct _MHD_dumbClient *clnt)
                     (0 != es.fd_count));
         externalErrorExitDesc ("Unexpected select() error");
 #endif /* ! MHD_POSIX_SOCKETS */
+        continue;
       }
       if (_MHD_dumbClient_process_from_fdsets (clnt, &rs, &ws, &es))
         return 0;
     }
-    now = time (NULL);
     /* Use double timeout value here as MHD must catch timeout situations
      * in this test. Timeout in client as a last resort. */
-  } while (now - start <= (TIMEOUTS_VAL * 2));
+  } while ((now = time (NULL)) - start <= (TIMEOUTS_VAL * 2));
   return 1;
 }
 
@@ -1223,7 +1223,6 @@ static int
 performQueryExternal (struct MHD_Daemon *d, struct _MHD_dumbClient *clnt)
 {
   time_t start;
-  time_t now;
   struct timeval tv;
   int ret;
   const union MHD_DaemonInfo *di;
@@ -1280,6 +1279,7 @@ performQueryExternal (struct MHD_Daemon *d, struct 
_MHD_dumbClient *clnt)
         externalErrorExitDesc ("Unexpected select() error");
       Sleep (1);
 #endif
+      continue;
     }
     if (MHD_YES != MHD_run_from_select (d, &rs, &ws, &es))
       mhdErrorExitDesc ("MHD_run_from_select() failed");
@@ -1296,10 +1296,9 @@ performQueryExternal (struct MHD_Daemon *d, struct 
_MHD_dumbClient *clnt)
           clnt = NULL;
       }
     }
-    now = time (NULL);
     /* Use double timeout value here so MHD would be able to catch timeout
      * internally */
-  } while (now - start <= (TIMEOUTS_VAL * 2));
+  } while (time (NULL) - start <= (TIMEOUTS_VAL * 2));
 
   return ret;
 }

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