gnunet-svn
[Top][All Lists]
Advanced

[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.



reply via email to

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