libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 8f4deef998dd41d7474436f70901618e64d0762f
parent 6d8b462082b0e8c69021bac140cd7d06686de6af
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 15 May 2009 17:53:25 +0000

grow buffer earlier

Diffstat:
MChangeLog | 4++++
Msrc/daemon/connection.c | 5+++++
2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,7 @@ +Fri May 15 11:00:20 MDT 2009 + Grow reserved read buffer more aggressively so that we are not + needlessly stuck reading only a handfull of bytes in each iteration. -CG + Thu May 14 21:20:30 MDT 2009 Fixed issue where the "NOTIFY_COMPLETED" handler could be called twice (if a socket error or timeout occured for a pipelined diff --git a/src/daemon/connection.c b/src/daemon/connection.c @@ -1543,6 +1543,11 @@ MHD_connection_handle_read (struct MHD_Connection *connection) connection->last_activity = time (NULL); if (connection->state == MHD_CONNECTION_CLOSED) return MHD_NO; + /* make sure "read" has a reasonable number of bytes + in buffer to use per system call (if possible) */ + if (connection->read_buffer_offset + MHD_BUF_INC_SIZE > + connection->read_buffer_size) + try_grow_read_buffer (connection); if (MHD_NO == do_read (connection)) return MHD_YES; while (1)