mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
SIGPIPE macros minor refactoring
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) );
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user