gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] 21/154: mhd_send.c: Use daemon from connect


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] 21/154: mhd_send.c: Use daemon from connection struct.
Date: Mon, 19 Aug 2019 10:15:33 +0200

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

ng0 pushed a commit to branch master
in repository libmicrohttpd.

commit 843b844d64578aa20749658c656d93ea2e17710c
Author: ng0 <address@hidden>
AuthorDate: Thu Jul 18 16:18:30 2019 +0000

    mhd_send.c: Use daemon from connection struct.
---
 src/microhttpd/mhd_send.c | 83 ++++++++++++++++++++++++-----------------------
 1 file changed, 43 insertions(+), 40 deletions(-)

diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index c6218870..d32533a8 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -90,13 +90,13 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
   const MHD_SCKT_OPT_BOOL_ on_val = 1;
   const int err = MHD_socket_get_error_ ();
 
-  // error handling from send_param_adapter()
+  /* error handling from send_param_adapter() */
   if ((MHD_INVALID_SOCKET == s) || (MHD_CONNECTION_CLOSED == 
connection->state))
   {
     return MHD_ERR_NOTCONN_;
   }
 
-  // from send_param_adapter()
+  /* from send_param_adapter() */
   if (buffer_size > MHD_SCKT_SEND_MAX_SIZE_)
     buffer_size = MHD_SCKT_SEND_MAX_SIZE_; /* return value limit */
 
@@ -142,17 +142,18 @@ MHD_send_on_connection_ (struct MHD_Connection 
*connection,
   {
     if (have_cork && ! want_cork)
     {
-      setsockopt (connection->socket_fd,
-                  IPPROTO_TCP,
-                  TCP_CORK,
-                  (const void *) &on_val,
-                  sizeof (on_val)) ||
-        (setsockopt (connection->socket_fd,
-                     IPPROTO_TCP,
-                     TCP_NODELAY,
-                     (const void *) &on_val,
-                     sizeof (on_val)) &&
-         (connection->sk_tcp_nodelay = true));
+      if (0 == setsockopt (connection->socket_fd,
+                           IPPROTO_TCP,
+                           TCP_CORK,
+                           (const void *) &on_val,
+                           sizeof (on_val)))
+      else if (0 == setsockopt (connection->socket_fd,
+                                IPPROTO_TCP,
+                                TCP_NODELAY,
+                                (const void *) &on_val,
+                                sizeof (on_val))) {
+        connection->sk_tcp_nodelay = true;
+      }
       //setsockopt (cork-on); // or nodelay on // + update 
connection->sk_tcp_nodelay_on
       // When we have CORK, we can have NODELAY on the same system,
       // at least since Linux 2.2 and both can be combined since
@@ -215,12 +216,11 @@ MHD_send_on_connection_ (struct MHD_Connection 
*connection,
   */
 
   /* for TLS*/
-  /*
-  if (0 != (daemon->options & MHD_USE_TLS))
-    TLS;
+
+  if (0 != (connection->daemon->options & MHD_USE_TLS))
+    /* old TLS code here */;
   else
     no-TLS;
-  */
 
   // shouldn't we return 0 or -1? Why re-use the _ERR_ functions?
   // error handling from send_param_adapter():
@@ -256,17 +256,18 @@ MHD_send_on_connection_ (struct MHD_Connection 
*connection,
     if (! have_cork && want_cork && ! have_more)
     {
       //setsockopt (cork-off); // or nodelay off // + update 
connection->sk_tcp_nodelay_on
-      setsockopt (connection->socket_fd,
-                  IPPROTO_TCP,
-                  TCP_CORK,
-                  (const void *) &off_val,
-                  sizeof (off_val)) ||
-        (setsockopt (connection->socket_fd,
-                     IPPROTO_TCP,
-                     TCP_NODELAY,
-                     (const void *) &off_val,
-                     sizeof (off_val)) &&
-         (connection->sk_tcp_nodelay_on = false));
+      if (0 == setsockopt (connection->socket_fd,
+                           IPPROTO_TCP,
+                           TCP_CORK,
+                           (const void *) &off_val,
+                           sizeof (off_val)))
+      else if (0 == setsockopt (connection->socket_fd,
+                                IPPROTO_TCP,
+                                TCP_NODELAY,
+                                (const void *) &off_val,
+                                sizeof (off_val))) {
+        connection->sk_tcp_nodelay_on = false;
+      }
     }
   }
 #elif TCP_NOPUSH
@@ -283,12 +284,13 @@ MHD_send_on_connection_ (struct MHD_Connection 
*connection,
     if (have_cork && ! want_cork)
     {
       // setsockopt (nodelay - on);
-      setsockopt (connection->socket_fd,
-                  IPPROTO_TCP,
-                  TCP_NODELAY,
-                  (const void *) &on_val,
-                  sizeof (on_val)) &&
-        (connection->sk_tcp_nodelay_on = true);
+      if (0 == setsockopt (connection->socket_fd,
+                           IPPROTO_TCP,
+                           TCP_NODELAY,
+                           (const void *) &on_val,
+                           sizeof (on_val))) {
+        connection->sk_tcp_nodelay_on = true;
+      }
     }
     // ...
   }
@@ -337,12 +339,13 @@ MHD_send_on_connection2_ (struct MHD_Connection 
*connection,
     if (! have_cork && want_cork)
     {
       // setsockopt (nodelay-off);
-      setsockopt (connection->socket_fd,
-                  IPPROTO_TCP,
-                  TCP_NODELAY,
-                  (const void *) &off_val,
-                  sizeof (off_val)) &&
-        (connection->sk_tcp_nodelay = false);
+      if (0 == setsockopt (connection->socket_fd,
+                           IPPROTO_TCP,
+                           TCP_NODELAY,
+                           (const void *) &off_val,
+                           sizeof (off_val))) {
+        connection->sk_tcp_nodelay = false;
+      }
     }
     // ...
   }

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



reply via email to

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