[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 70/154: conditionally return and setsockopt
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 70/154: conditionally return and setsockopt. |
Date: |
Mon, 19 Aug 2019 10:16:22 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository libmicrohttpd.
commit cf1206ff78e7e9d0d3e5eab7c05a06ab67cc2d8e
Author: ng0 <address@hidden>
AuthorDate: Wed Jul 24 13:32:01 2019 +0000
conditionally return and setsockopt.
---
src/microhttpd/connection.c | 64 +++++++++++++++++++++++++--------------------
1 file changed, 36 insertions(+), 28 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 4b8b7a4a..02f065a0 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -295,6 +295,7 @@ sendfile_adapter (struct MHD_Connection *connection)
bool using_tls = false;
ssize_t ret;
+ ssize_t lo_ret;
const int file_fd = connection->response->fd;
uint64_t left;
uint64_t offsetu64;
@@ -461,51 +462,58 @@ sendfile_adapter (struct MHD_Connection *connection)
ret = (ssize_t)len;
#endif /* HAVE_FREEBSD_SENDFILE */
- /* ! could be avoided by redefining the variable. */
- have_cork = ! connection->sk_tcp_nodelay_on;
+ ret = lo_ret;
+ (if 0 > ret)
+ {
+ /* ! could be avoided by redefining the variable. */
+ have_cork = ! connection->sk_tcp_nodelay_on;
#ifdef MSG_MORE
- have_more = true;
+ have_more = true;
#else
- have_more = false;
+ have_more = false;
#endif
#if TCP_NODELAY
- use_corknopush = false;
+ use_corknopush = false;
#elif TCP_CORK
- use_corknopush = true;
+ use_corknopush = true;
#elif TCP_NOPUSH
- use_corknopush = true;
+ use_corknopush = true;
#endif
#ifdef HTTPS_SUPPORT
- using_tls = (0 != (connection->daemon->options & MHD_USE_TLS));
+ using_tls = (0 != (connection->daemon->options & MHD_USE_TLS));
#endif
#if TCP_CORK
- /* When we have CORK, we can have NODELAY on the same system,
- * at least since Linux 2.2 and both can be combined since
- * Linux 2.5.71. For more details refer to tcp(7) on Linux.
- * No other system in 2019-06 has TCP_CORK. */
- if ((! using_tls) && (use_corknopush) && (have_cork && ! want_cork))
- {
- MHD_send_socket_state_cork_nodelay_ (connection,
- false,
- true,
- true,
- true);
- }
+ /* When we have CORK, we can have NODELAY on the same system,
+ * at least since Linux 2.2 and both can be combined since
+ * Linux 2.5.71. For more details refer to tcp(7) on Linux.
+ * No other system in 2019-06 has TCP_CORK. */
+ if ((! using_tls) && (use_corknopush) && (have_cork && ! want_cork))
+ {
+ MHD_send_socket_state_cork_nodelay_ (connection,
+ false,
+ true,
+ true,
+ true);
+ }
#elif TCP_NOPUSH
- /* TCP_NOPUSH on FreeBSD is equal to cork on Linux, with the
- * exception that we know that TCP_NOPUSH will definitely
- * exist and we can disregard TCP_NODELAY unless requested. */
- if ((! using_tls) && (use_corknopush) && (have_cork && ! want_cork))
+ /* TCP_NOPUSH on FreeBSD is equal to cork on Linux, with the
+ * exception that we know that TCP_NOPUSH will definitely
+ * exist and we can disregard TCP_NODELAY unless requested. */
+ if ((! using_tls) && (use_corknopush) && (have_cork && ! want_cork))
+ {
+ MHD_send_socket_state_nopush_ (connection, true, false);
+ }
+#endif
+ return lo_ret;
+ }
+ else
{
- MHD_send_socket_state_nopush_ (connection, true, false);
+ return ret;
}
-#endif
-
- return ret;
}
#endif /* _MHD_HAVE_SENDFILE */
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [libmicrohttpd] 54/154: Merge branch 'dev/ng0/gsoc2019' of git+ssh://gnunet.org/libmicrohttpd into dev/ng0/gsoc2019, (continued)
- [GNUnet-SVN] [libmicrohttpd] 54/154: Merge branch 'dev/ng0/gsoc2019' of git+ssh://gnunet.org/libmicrohttpd into dev/ng0/gsoc2019, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 51/154: gnutls cork integration, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 61/154: incomplete commit, adding 2 new helper functions and more., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 69/154: function replace., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 79/154: fix, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 82/154: revert last patch, should be only on master for now, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 67/154: remove commented code, replaced by functions., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 85/154: pre_cork socket.., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 72/154: first attempt to add MHD_send_on_connection2_, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 66/154: doxygen., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 70/154: conditionally return and setsockopt.,
gnunet <=
- [GNUnet-SVN] [libmicrohttpd] 74/154: fix failure to build., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 73/154: Start reworking into generic setsockopt wrapper., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 84/154: Merge branch 'dev/ng0/gsoc2019' of gnunet.org:libmicrohttpd into dev/ng0/gsoc2019, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 77/154: fix, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 78/154: buffersize, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 90/154: show not tell, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 81/154: Merge branch 'dev/ng0/gsoc2019' of git+ssh://gnunet.org/libmicrohttpd into dev/ng0/gsoc2019, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 83/154: post_cork function first draft, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 63/154: attempt fix., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 80/154: fix regression introduced in cc5032b85, gnunet, 2019/08/19