gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 04/04: MHD_send_hdr_and_body_: streamlined code


From: gnunet
Subject: [libmicrohttpd] 04/04: MHD_send_hdr_and_body_: streamlined code
Date: Sun, 13 Dec 2020 15:37:53 +0100

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 526de1a8e1da6a1e5509bd12775c7a1795370bc8
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun Dec 13 17:37:14 2020 +0300

    MHD_send_hdr_and_body_: streamlined code
---
 src/microhttpd/mhd_send.c | 34 ++++++++++++++--------------------
 1 file changed, 14 insertions(+), 20 deletions(-)

diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index 8abd30d6..1f187902 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -822,6 +822,9 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection,
 #if defined(HAVE_SENDMSG) || defined(HAVE_WRITEV)
   MHD_socket s = connection->socket_fd;
   struct iovec vector[2];
+#ifdef HAVE_SENDMSG
+  struct msghdr msg;
+#endif /* HAVE_SENDMSG */
 #ifdef HTTPS_SUPPORT
   const bool no_vec = (connection->daemon->options & MHD_USE_TLS);
 #else  /* ! HTTPS_SUPPORT */
@@ -925,28 +928,19 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection,
   vector[1].iov_len = body_size;
 
 #if HAVE_SENDMSG
-  {
-    struct msghdr msg;
-
-    memset (&msg, 0, sizeof(struct msghdr));
-    msg.msg_iov = vector;
-    msg.msg_iovlen = 2;
+  memset (&msg, 0, sizeof(struct msghdr));
+  msg.msg_iov = vector;
+  msg.msg_iovlen = 2;
 
-    ret = sendmsg (s, &msg, MSG_NOSIGNAL_OR_ZERO);
-    if ( (-1 == ret) &&
-         (EAGAIN == errno) )
-      return MHD_ERR_AGAIN_;
-  }
+  ret = sendmsg (s, &msg, MSG_NOSIGNAL_OR_ZERO);
+  if ( (-1 == ret) &&
+       (EAGAIN == errno) )
+    return MHD_ERR_AGAIN_;
 #elif HAVE_WRITEV
-  {
-    int iovcnt;
-
-    iovcnt = sizeof (vector) / sizeof (struct iovec);
-    ret = writev (s, vector, iovcnt);
-    if ( (-1 == ret) &&
-         (EAGAIN == errno) )
-      return MHD_ERR_AGAIN_;
-  }
+  ret = writev (s, vector, 2);
+  if ( (-1 == ret) &&
+       (EAGAIN == errno) )
+    return MHD_ERR_AGAIN_;
 #endif
 
   /* If there is a need to push the data from network buffers

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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