gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (d3589c58 -> 1d5efc03)


From: gnunet
Subject: [libmicrohttpd] branch master updated (d3589c58 -> 1d5efc03)
Date: Fri, 25 Dec 2020 18:18:55 +0100

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from d3589c58 Revert "fix #6594: better test for gnutls_record_uncork"
     new 9e846e52 Fixed build and socket init on macOS
     new 1d5efc03 Examples: fixed logic error

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/examples/websocket_threaded_example.c |  4 ++--
 src/microhttpd/mhd_sockets.c              | 24 ++++++++++++++----------
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/examples/websocket_threaded_example.c 
b/src/examples/websocket_threaded_example.c
index 2c1f31b3..1f4db5b8 100644
--- a/src/examples/websocket_threaded_example.c
+++ b/src/examples/websocket_threaded_example.c
@@ -714,16 +714,16 @@ run_usock (void *cls)
       size = sprintf (client, "User#%d: ", (int)ws->sock);
       size += got;
       text = malloc (size);
-      if (NULL != buf)
+      if (NULL != text)
       {
         sprintf (text, "%s%s", client, msg);
         sent = ws_send_frame (ws->sock, text, size);
+        free (text);
       }
       else
       {
         sent = -1;
       }
-      free (text);
       free (msg);
       if (-1 == sent)
       {
diff --git a/src/microhttpd/mhd_sockets.c b/src/microhttpd/mhd_sockets.c
index ef3dc35d..fef7085c 100644
--- a/src/microhttpd/mhd_sockets.c
+++ b/src/microhttpd/mhd_sockets.c
@@ -516,10 +516,9 @@ MHD_socket_cork_ (MHD_socket sock,
                        (const void *) (on ? &on_val : &off_val),
                        sizeof (off_val)))
     return 0; /* failed */
-#if defined(__FreeBSD__) && __FreeBSD__ + 0 >= 9
-  /* FreeBSD do not need zero-send for flushing starting from version 9 */
+#if defined(_MHD_CORK_RESET_PUSH_DATA)
   return 1;
-#elif defined(TCP_NOPUSH) && ! defined(TCP_CORK)
+#else  /* ! _MHD_CORK_RESET_PUSH_DATA */
   if (! on)
   {
     const int dummy = 0;
@@ -533,14 +532,13 @@ MHD_socket_cork_ (MHD_socket sock,
       return 0; /* even force flush failed!? */
     return 1; /* success */
   }
-#else
-  return 1; /* success */
-#endif
-#else
+  return 1;
+#endif /* ! _MHD_CORK_RESET_PUSH_DATA */
+#else  /* ! MHD_TCP_CORK_NOPUSH */
   /* do not have MHD_TCP_CORK_NOPUSH at all */
   (void) sock; (void) on; /* Mute compiler warnings */
   return 0;
-#endif
+#endif /* ! MHD_TCP_CORK_NOPUSH */
 }
 
 
@@ -589,10 +587,13 @@ MHD_socket_create_listen_ (int pf)
   fd = socket (pf,
                SOCK_STREAM | SOCK_CLOEXEC | SOCK_NOSIGPIPE_OR_ZERO,
                0);
-  cloexec_set = (SOCK_CLOEXEC_OR_ZERO != 0);
+  if (MHD_INVALID_SOCKET != fd)
+  {
+    cloexec_set = (SOCK_CLOEXEC_OR_ZERO != 0);
 #if defined(SOCK_NOSIGPIPE) || defined(MHD_socket_nosignal_)
-  nosigpipe_set = (SOCK_NOSIGPIPE_OR_ZERO != 0);
+    nosigpipe_set = (SOCK_NOSIGPIPE_OR_ZERO != 0);
 #endif /* SOCK_NOSIGPIPE ||  MHD_socket_nosignal_ */
+  }
 #elif defined(MHD_WINSOCK_SOCKETS) && defined (WSA_FLAG_NO_HANDLE_INHERIT)
   fd = WSASocketW (pf,
                    SOCK_STREAM,
@@ -610,6 +611,9 @@ MHD_socket_create_listen_ (int pf)
                  SOCK_STREAM,
                  0);
     cloexec_set = 0;
+#if defined(SOCK_NOSIGPIPE) || defined(MHD_socket_nosignal_)
+    nosigpipe_set = 0;
+#endif /* SOCK_NOSIGPIPE ||  MHD_socket_nosignal_ */
   }
   if (MHD_INVALID_SOCKET == fd)
     return MHD_INVALID_SOCKET;

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