gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 01/05: enum MHD_SendSocketOptions: renamed values for cl


From: gnunet
Subject: [libmicrohttpd] 01/05: enum MHD_SendSocketOptions: renamed values for clarity. The most important is to push the last peace of response data. Without pushing data, MHD is limited to 5 requests/second (on typical OS) with stay-alive clients.
Date: Sun, 29 Nov 2020 19:50:10 +0100

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 7f6084e6306b1a35a62a496e8335b41825a6b22d
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun Nov 29 18:18:10 2020 +0300

    enum MHD_SendSocketOptions: renamed values for clarity.
    The most important is to push the last peace of response data.
    Without pushing data, MHD is limited to 5 requests/second
    (on typical OS) with stay-alive clients.
---
 src/microhttpd/connection.c | 10 +++++-----
 src/microhttpd/mhd_send.c   |  4 ++--
 src/microhttpd/mhd_send.h   | 13 +++++++++----
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index b85597c4..be88d874 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2884,7 +2884,7 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection)
                                    [connection->continue_message_write_offset],
                                    MHD_STATICSTR_LEN_ (HTTP_100_CONTINUE)
                                    - connection->continue_message_write_offset,
-                                   MHD_SSO_NO_CORK);
+                                   MHD_SSO_PUSH_DATA);
     if (ret < 0)
     {
       if (MHD_ERR_AGAIN_ == ret)
@@ -2927,7 +2927,7 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection)
                                        &connection->write_buffer
                                        [connection->write_buffer_send_offset],
                                        wb_ready,
-                                       MHD_SSO_MAY_CORK);
+                                       MHD_SSO_PREFER_BUFF);
       }
       else
       {
@@ -3004,7 +3004,7 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection)
                                        [(size_t) data_write_offset],
                                        response->data_size
                                        - (size_t) data_write_offset,
-                                       MHD_SSO_NO_CORK);
+                                       MHD_SSO_PUSH_DATA);
 #if _MHD_DEBUG_SEND_DATA
         if (ret > 0)
           fprintf (stderr,
@@ -3048,7 +3048,7 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection)
                                    [connection->write_buffer_send_offset],
                                    connection->write_buffer_append_offset
                                    - connection->write_buffer_send_offset,
-                                   MHD_SSO_NO_CORK);
+                                   MHD_SSO_PUSH_DATA);
     if (ret < 0)
     {
       if (MHD_ERR_AGAIN_ == ret)
@@ -3078,7 +3078,7 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection)
                                    [connection->write_buffer_send_offset],
                                    connection->write_buffer_append_offset
                                    - connection->write_buffer_send_offset,
-                                   MHD_SSO_NO_CORK);
+                                   MHD_SSO_PUSH_DATA);
     if (ret < 0)
     {
       if (MHD_ERR_AGAIN_ == ret)
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index 6e362252..764fd82d 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -329,11 +329,11 @@ MHD_send_on_connection_ (struct MHD_Connection 
*connection,
   switch (options)
   {
   /* No corking */
-  case MHD_SSO_NO_CORK:
+  case MHD_SSO_PUSH_DATA:
     want_cork = false;
     break;
   /* Do corking, consider MSG_MORE instead if available. */
-  case MHD_SSO_MAY_CORK:
+  case MHD_SSO_PREFER_BUFF:
     want_cork = true;
     break;
   /* Cork the header. */
diff --git a/src/microhttpd/mhd_send.h b/src/microhttpd/mhd_send.h
index 12ac1ac6..638dbade 100644
--- a/src/microhttpd/mhd_send.h
+++ b/src/microhttpd/mhd_send.h
@@ -54,13 +54,18 @@ MHD_send_init_static_vars_ (void);
 enum MHD_SendSocketOptions
 {
   /**
-   * definitely no corking (use NODELAY, or explicitly disable cork)
+   * Need to flush buffers after send to push data to the network.
+   * Used to avoid delay before the last part of data (which is usually
+   * incomplete IP packet / MSS) is pushed by kernel to the network.
    */
-  MHD_SSO_NO_CORK = 0,
+  MHD_SSO_PUSH_DATA = 0,
   /**
-   * should enable corking (use MSG_MORE, or explicitly enable cork)
+   * Buffer data if possible.
+   * If more response data is to be sent than try to buffer data in
+   * the local buffers so kernel able to send complete packets with
+   * lower overhead.
    */
-  MHD_SSO_MAY_CORK = 1,
+  MHD_SSO_PREFER_BUFF = 1,
   /**
    * consider tcpi_snd_mss and consider not corking for the header
    * part if the size of the header is close to the MSS.

-- 
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]