gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 01/06: SIGPIPE macros minor refactoring


From: gnunet
Subject: [libmicrohttpd] 01/06: SIGPIPE macros minor refactoring
Date: Wed, 24 Feb 2021 17:48:46 +0100

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 7bbbcd63f987b5451a29d3e084e045fc2ba1d14a
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Thu Feb 18 12:43:00 2021 +0300

    SIGPIPE macros minor refactoring
---
 src/microhttpd/connection.c  |  6 ++++--
 src/microhttpd/daemon.c      | 14 +++++++++-----
 src/microhttpd/mhd_send.c    | 11 ++++++-----
 src/microhttpd/mhd_sockets.h | 13 +++++++++----
 4 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index f7d25962..25788414 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -3977,9 +3977,11 @@ MHD_queue_response (struct MHD_Connection *connection,
   if ( (response->fd == -1) ||
        (response->is_pipe) ||
        (0 != (connection->daemon->options & MHD_USE_TLS))
-#if ! defined(MHD_WINSOCK_SOCKETS) && defined(HAVE_SEND_SIGPIPE_SUPPRESS)
+#if defined(MHD_SEND_SPIPE_SUPPRESS_NEEDED) && \
+       defined(MHD_SEND_SPIPE_SUPPRESS_POSSIBLE)
        || (! daemon->sigpipe_blocked && ! connection->sk_spipe_suppress)
-#endif /* ! MHD_WINSOCK_SOCKETS && ! HAVE_SEND_SIGPIPE_SUPPRESS */
+#endif /* MHD_SEND_SPIPE_SUPPRESS_NEEDED &&
+          MHD_SEND_SPIPE_SUPPRESS_POSSIBLE */
        )
     connection->resp_sender = MHD_resp_sender_std;
   else
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index cae031bd..bcf1a014 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2243,7 +2243,9 @@ static void
 MHD_cleanup_connections (struct MHD_Daemon *daemon);
 
 #if defined(HTTPS_SUPPORT)
-#if ! defined(MHD_WINSOCK_SOCKETS) && ! defined(MHD_socket_nosignal_) && \
+#if defined(MHD_SEND_SPIPE_SUPPRESS_NEEDED) && \
+  defined(MHD_SEND_SPIPE_SUPPRESS_POSSIBLE) && \
+  ! defined(MHD_socket_nosignal_) && \
   (GNUTLS_VERSION_NUMBER + 0 < 0x030402) && defined(MSG_NOSIGNAL)
 /**
  * Older version of GnuTLS do not support suppressing of SIGPIPE signal.
@@ -2251,8 +2253,10 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon);
  * and if possible.
  */
 #define MHD_TLSLIB_NEED_PUSH_FUNC 1
-#endif \
-  /* !MHD_WINSOCK_SOCKETS && !MHD_socket_nosignal_ && (GNUTLS_VERSION_NUMBER+0 
< 0x030402) */
+#endif /* MHD_SEND_SPIPE_SUPPRESS_NEEDED &&
+          MHD_SEND_SPIPE_SUPPRESS_POSSIBLE &&
+          ! MHD_socket_nosignal_ && (GNUTLS_VERSION_NUMBER+0 < 0x030402) &&
+          MSG_NOSIGNAL */
 
 #ifdef MHD_TLSLIB_NEED_PUSH_FUNC
 /**
@@ -7740,8 +7744,8 @@ MHD_is_feature_supported (enum MHD_FEATURE feature)
     return MHD_NO;
 #endif
   case MHD_FEATURE_AUTOSUPPRESS_SIGPIPE:
-#if defined(MHD_WINSOCK_SOCKETS) || defined(MHD_socket_nosignal_) || \
-    defined (MSG_NOSIGNAL)
+#if defined(MHD_SEND_SPIPE_SUPPRESS_POSSIBLE) && \
+    defined(MHD_SEND_SPIPE_SUPPRESS_NEEDED)
     return MHD_YES;
 #else
     return MHD_NO;
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index ac11b693..0d979c0a 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -812,13 +812,14 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection,
 #ifdef HTTPS_SUPPORT
   no_vec = no_vec || (connection->daemon->options & MHD_USE_TLS);
 #endif /* HTTPS_SUPPORT */
-#if ! defined(MHD_WINSOCK_SOCKETS) && \
-  (! defined(HAVE_SENDMSG) || ! defined(MSG_NOSIGNAL)) && \
-  defined(HAVE_SEND_SIGPIPE_SUPPRESS)
+#if (! defined(HAVE_SENDMSG) || ! defined(MSG_NOSIGNAL) ) && \
+  defined(MHD_SEND_SPIPE_SEND_SUPPRESS_POSSIBLE) && \
+  defined(MHD_SEND_SPIPE_SUPPRESS_NEEDED)
   no_vec = no_vec || (! connection->daemon->sigpipe_blocked &&
                       ! connection->sk_spipe_suppress);
-#endif /* !MHD_WINSOCK_SOCKETS && (!HAVE_SENDMSG || ! MSG_NOSIGNAL)
-          && !HAVE_SEND_SIGPIPE_SUPPRESS */
+#endif /* (!HAVE_SENDMSG || ! MSG_NOSIGNAL) &&
+          MHD_SEND_SPIPE_SEND_SUPPRESS_POSSIBLE &&
+          MHD_SEND_SPIPE_SUPPRESS_NEEDED */
 #endif /* _MHD_USE_SEND_VEC */
 
   mhd_assert ( (NULL != body) || (0 == body_size) );
diff --git a/src/microhttpd/mhd_sockets.h b/src/microhttpd/mhd_sockets.h
index d4f21690..c22a1b12 100644
--- a/src/microhttpd/mhd_sockets.h
+++ b/src/microhttpd/mhd_sockets.h
@@ -934,17 +934,22 @@ static const int _MHD_socket_int_one = 1;
 #endif /* SOL_SOCKET && SO_NOSIGPIPE */
 
 
-#if defined(MHD_WINSOCK_SOCKETS) || defined(MHD_socket_nosignal_) || \
-  defined(MSG_NOSIGNAL)
+#if defined(MHD_socket_nosignal_) || defined(MSG_NOSIGNAL)
 /**
- * Indicate that SIGPIPE can be suppressed for normal send() by flags
+ * Indicate that SIGPIPE can be suppressed by MHD for normal send() by flags
  * or socket options.
  * If this macro is undefined, MHD cannot suppress SIGPIPE for normal
  * processing so sendfile() or writev() calls is not avoided.
  */
-#define HAVE_SEND_SIGPIPE_SUPPRESS      1
+#define MHD_SEND_SPIPE_SUPPRESS_POSSIBLE   1
 #endif /* MHD_WINSOCK_SOCKETS || MHD_socket_nosignal_ || MSG_NOSIGNAL */
 
+#if ! defined(MHD_WINSOCK_SOCKETS)
+/**
+ * Indicate that suppression of SIGPIPE is required.
+ */
+#define MHD_SEND_SPIPE_SUPPRESS_NEEDED     1
+#endif
 
 /**
  * Create a listen socket, with noninheritable flag if possible.

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