[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 02/03: connection: handle large read-ahead situation
From: |
gnunet |
Subject: |
[libmicrohttpd] 02/03: connection: handle large read-ahead situation |
Date: |
Sat, 05 Jun 2021 14:39:17 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 2ccc281a69a056bc4fe72b829604037fa3792bfc
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Jun 4 15:22:22 2021 +0300
connection: handle large read-ahead situation
---
src/microhttpd/connection.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 321952eb..5038b378 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -3887,6 +3887,7 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
else
{
/* can try to keep-alive */
+ size_t new_read_buf_size;
connection->version = NULL;
connection->http_ver = MHD_HTTP_VER_UNKNOWN;
@@ -3897,13 +3898,16 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
connection->keepalive = MHD_CONN_KEEPALIVE_UNKOWN;
/* Reset the read buffer to the starting size,
preserving the bytes we have already read. */
+ if (connection->read_buffer_offset > connection->daemon->pool_size / 2)
+ new_read_buf_size = connection->read_buffer_offset;
+ else
+ new_read_buf_size = connection->daemon->pool_size / 2;
connection->read_buffer
= MHD_pool_reset (connection->pool,
connection->read_buffer,
connection->read_buffer_offset,
- connection->daemon->pool_size / 2);
- connection->read_buffer_size
- = connection->daemon->pool_size / 2;
+ new_read_buf_size);
+ connection->read_buffer_size = new_read_buf_size;
}
connection->client_context = NULL;
connection->continue_message_write_offset = 0;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.