gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] 128/154: TCP_NOPUSH


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] 128/154: TCP_NOPUSH
Date: Mon, 19 Aug 2019 10:17:20 +0200

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

ng0 pushed a commit to branch master
in repository libmicrohttpd.

commit e099a6ea0a9731d888388d5cc716be02057f4c25
Author: ng0 <address@hidden>
AuthorDate: Thu Aug 1 17:41:55 2019 +0000

    TCP_NOPUSH
---
 src/microhttpd/mhd_send.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index 87cecfb4..93fabd4f 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -83,10 +83,21 @@ pre_cork_setsockopt (struct MHD_Connection *connection,
                       sizeof (on_val));
   }
 #elif TCP_NOPUSH
+  if (want_cork)
   {
     const MHD_SCKT_OPT_BOOL_ on_val = 1;
+    /* TCP_NOPUSH has the same logic as MSG_MSG_MORE.
+     * The two are more or less equivalent by a source
+     * transformation (ie
+     * send(MSG_MORE) => "set TCP_NOPUSH + send() + clear TCP_NOPUSH".
+     * Both of them are really fairly "local", but TCP_NOPUSH has a
+     * _notion_ of persistency that is entirely lacking in MSG_MORE.
+     * ... with TCP_NOPUSH you basically have to know what your last
+     * write is, and clear the bit _before_ that write if you want
+     * to avoid bad latencies.
+     * https://yarchive.net/comp/linux/sendfile.html A thread from 2001,
+     * take with 18 grains of salt. */
 
-    // FIXME: this must be wrong, set unconditionally irrespective of 
'want_cork'!
     ret = setsockopt (connection->socket_fd,
                       IPPROTO_TCP,
                       TCP_NOPUSH,
@@ -117,8 +128,8 @@ pre_cork_setsockopt (struct MHD_Connection *connection,
           break;
         case ENOPROTOOPT:
           /* FIXME: optlen unknown, should at least log this */
-          break;
-        default:
+          break; 
+       default:
           /* any others? man page does not list more... */
           break;
         }
@@ -163,10 +174,9 @@ post_cork_setsockopt (struct MHD_Connection *connection,
 #elif TCP_NODELAY
   /* nothing to do */
 #elif TCP_NOPUSH
-  // FIXME: this must be wrong, set unconditionally irrespective of 
'want_cork'!
+  if (! want_cork)
   {
     const MHD_SCKT_OPT_BOOL_ off_val = 0;
-    const MHD_SCKT_OPT_BOOL_ on_val = 1;
 
     ret = setsockopt (connection->socket_fd,
                       IPPROTO_TCP,

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]