[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 36/154: implement TCP_NOPUSH branch content
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 36/154: implement TCP_NOPUSH branch content |
Date: |
Mon, 19 Aug 2019 10:15:48 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository libmicrohttpd.
commit 068cf22c0357b13e2f84ca6a10c6823a24264d96
Author: ng0 <address@hidden>
AuthorDate: Sat Jul 20 14:25:02 2019 +0000
implement TCP_NOPUSH branch content
---
src/microhttpd/mhd_send.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index 6ad79fb9..8ff9b459 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -50,7 +50,6 @@
* to be used in: send_param_adapter, MHD_send_
* and every place where sendfile(), sendfile64(), setsockopt() are used.
*
- * Fix this up in doxygen style:
* -- OBJECTIVE:
* connection: use member 'socket', and remember the
* current state of the socket-options (cork/nocork/nodelay/whatever)
@@ -98,17 +97,17 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
case MHD_SSO_NO_CORK:
want_cork = false;
break;
- /* Do corking, consider MSG_MORE instead if available */
+ /* Do corking, consider MSG_MORE instead if available. */
case MHD_SSO_MAY_CORK:
want_cork = true;
break;
- /* Cork the header */
+ /* Cork the header. */
case MHD_SSO_HDR_CORK:
want_cork = (buffer_size >= 1024) && (buffer_size <= 1220);
break;
}
- // ! could be avoided by redefining the variable
+ /* ! could be avoided by redefining the variable. */
have_cork = ! connection->sk_tcp_nodelay_on;
#ifdef MSG_MORE
@@ -270,10 +269,20 @@ MHD_send_on_connection_ (struct MHD_Connection
*connection,
}
}
#elif TCP_NOPUSH
- // We don't have MSG_MORE.
- if (use_corknopush)
+ /* We don't have MSG_MORE. The OS which implement NOPUSH implement
+ * it in a similar way to TCP_CORK on Linux. This means we can just
+ * disregard the else branch for TCP_NODELAY which we had to use
+ * for the TCP_CORK case here. */
+ if ((! using_tls) && (use_corknopush) && (have_cork && ! want_cork))
{
- if (! have_more && )// ...
+ if (0 == setsockopt (s,
+ IPPROTO_TCP,
+ TCP_NOPUSH,
+ (const void*) &on_val,
+ sizeof (on_val)))
+ {
+ connection->sk_tcp_nodelay_on = false;
+ }
}
#endif
@@ -364,7 +373,7 @@ MHD_send_on_connection2_ (struct MHD_Connection *connection,
eno = errno;
if ((ret == header_len + buffer_len) && have_cork)
{
- // response complete, definitely uncork!
+ // Response complete, definitely uncork!
setsockopt (s,
IPPROTO_TCP,
TCP_CORK,
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [libmicrohttpd] 21/154: mhd_send.c: Use daemon from connection struct., (continued)
- [GNUnet-SVN] [libmicrohttpd] 21/154: mhd_send.c: Use daemon from connection struct., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 45/154: fix compiler error., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 44/154: remove verbose comments in mhd_send.c, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 55/154: doxygen: MHD_SSO, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 30/154: comments, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 49/154: more OLDSOCK., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 59/154: sendfile and netbsd, comment., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 31/154: combine ifs, fix uninitialized var error, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 62/154: fix errors., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 35/154: use using_tls, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 36/154: implement TCP_NOPUSH branch content,
gnunet <=
- [GNUnet-SVN] [libmicrohttpd] 34/154: Use s in setsockopt(), gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 38/154: check getsockopt's., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 64/154: move sendfile function work to connection.c, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 58/154: start SENDMSG/WRITEV., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 60/154: doxygen fix., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 57/154: cover the case of TCP_NOPUSH and TCP_CORK coexisting on the same OS., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 56/154: doxygen, links, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 52/154: doxygen, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 40/154: doxygen for _send2, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 48/154: connection.c: preprocessor ifdef some setsockopts., gnunet, 2019/08/19