[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r27754 - in libmicrohttpd: . doc src/include src/microhttpd
From: |
gnunet |
Subject: |
[GNUnet-SVN] r27754 - in libmicrohttpd: . doc src/include src/microhttpd |
Date: |
Fri, 5 Jul 2013 12:12:11 +0200 |
Author: grothoff
Date: 2013-07-05 12:12:10 +0200 (Fri, 05 Jul 2013)
New Revision: 27754
Modified:
libmicrohttpd/AUTHORS
libmicrohttpd/ChangeLog
libmicrohttpd/doc/libmicrohttpd.texi
libmicrohttpd/src/include/microhttpd.h
libmicrohttpd/src/microhttpd/connection.c
libmicrohttpd/src/microhttpd/daemon.c
libmicrohttpd/src/microhttpd/internal.h
Log:
-fixing #2899: allow clients to customize MHD_BUF_INC_SIZE via option
Modified: libmicrohttpd/AUTHORS
===================================================================
--- libmicrohttpd/AUTHORS 2013-07-05 09:56:33 UTC (rev 27753)
+++ libmicrohttpd/AUTHORS 2013-07-05 10:12:10 UTC (rev 27754)
@@ -22,6 +22,7 @@
Colin Caughie <address@hidden>
David Carvalho <address@hidden>
David Reiss <address@hidden>
+Matt Holiday
Mika Raento <address@hidden>
Mike Crowe <address@hidden>
John Muth <address@hidden>
Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog 2013-07-05 09:56:33 UTC (rev 27753)
+++ libmicrohttpd/ChangeLog 2013-07-05 10:12:10 UTC (rev 27754)
@@ -1,3 +1,8 @@
+Fri Jul 5 12:05:01 CEST 2013
+ Added MHD_OPTION_CONNECTION_MEMORY_INCREMENT to allow users
+ to specify a custom value for incrementing read buffer
+ sizes (#2899). -MH
+
Fri Jun 28 14:05:15 CEST 2013
If we shutdown connection for reading on POST due to error,
really do not process further requests even if we already
Modified: libmicrohttpd/doc/libmicrohttpd.texi
===================================================================
--- libmicrohttpd/doc/libmicrohttpd.texi 2013-07-05 09:56:33 UTC (rev
27753)
+++ libmicrohttpd/doc/libmicrohttpd.texi 2013-07-05 10:12:10 UTC (rev
27754)
@@ -509,6 +509,15 @@
for IO, and TCP buffers are unlikely to support window sizes above 64k
on most systems.
address@hidden MHD_OPTION_CONNECTION_MEMORY_INCREMENT
address@hidden memory
+Increment to use for growing the read buffer (followed by a
address@hidden). The default is 1024 (bytes). Increasing this value
+will make MHD use memory for reading more aggressively, which can
+reduce the number of @code{recvfrom} calls but may increase the number
+of @code{sendto} calls. The given value must fit within
+MHD_OPTION_CONNECTION_MEMORY_LIMIT.
+
@item MHD_OPTION_CONNECTION_LIMIT
@cindex connection, limiting number of connections
Maximum number of concurrent connections to accept (followed by an
Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h 2013-07-05 09:56:33 UTC (rev
27753)
+++ libmicrohttpd/src/include/microhttpd.h 2013-07-05 10:12:10 UTC (rev
27754)
@@ -673,7 +673,13 @@
* HTTPS daemon for client authentification.
* This option should be followed by a "const char*" argument.
*/
- MHD_OPTION_HTTPS_MEM_TRUST = 20
+ MHD_OPTION_HTTPS_MEM_TRUST = 20,
+
+ /**
+ * Increment to use for growing the read buffer (followed by a
+ * size_t). Must fit within MHD_OPTION_CONNECTION_MEMORY_LIMIT.
+ */
+ MHD_OPTION_CONNECTION_MEMORY_INCREMENT = 21
};
Modified: libmicrohttpd/src/microhttpd/connection.c
===================================================================
--- libmicrohttpd/src/microhttpd/connection.c 2013-07-05 09:56:33 UTC (rev
27753)
+++ libmicrohttpd/src/microhttpd/connection.c 2013-07-05 10:12:10 UTC (rev
27754)
@@ -37,14 +37,6 @@
#include <netinet/tcp.h>
#endif
-/**
- * Minimum size by which MHD tries to increment read/write buffers.
- * We usually begin with half the available pool space for the
- * IO-buffer, but if absolutely needed we additively grow by the
- * number of bytes given here (up to -- theoretically -- the full pool
- * space).
- */
-#define MHD_BUF_INC_SIZE 1024
/**
* Message to transmit when http 1.1 request is received
@@ -1861,7 +1853,7 @@
return MHD_YES;
/* 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 >
+ if (connection->read_buffer_offset + connection->daemon->pool_increment >
connection->read_buffer_size)
try_grow_read_buffer (connection);
if (MHD_NO == do_read (connection))
Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c 2013-07-05 09:56:33 UTC (rev
27753)
+++ libmicrohttpd/src/microhttpd/daemon.c 2013-07-05 10:12:10 UTC (rev
27754)
@@ -1305,8 +1305,6 @@
struct sockaddr *addr = (struct sockaddr *) &addrstorage;
socklen_t addrlen;
int s;
- int flags;
- int need_fcntl;
int fd;
addrlen = sizeof (addrstorage);
@@ -1315,10 +1313,8 @@
return MHD_NO;
#if HAVE_ACCEPT4
s = accept4 (fd, addr, &addrlen, SOCK_CLOEXEC);
- need_fcntl = MHD_NO;
#else
s = ACCEPT (fd, addr, &addrlen);
- need_fcntl = MHD_YES;
#endif
if ((-1 == s) || (addrlen <= 0))
{
@@ -1339,7 +1335,6 @@
return MHD_NO;
}
#if !HAVE_ACCEPT4
- if (MHD_YES == need_fcntl)
{
/* make socket non-inheritable */
#ifdef WINDOWS
@@ -1356,6 +1351,8 @@
#endif
}
#else
+ int flags;
+
flags = fcntl (s, F_GETFD);
if ( ( (-1 == flags) ||
( (flags != (flags | FD_CLOEXEC)) &&
@@ -2377,6 +2374,9 @@
case MHD_OPTION_CONNECTION_MEMORY_LIMIT:
daemon->pool_size = va_arg (ap, size_t);
break;
+ case MHD_OPTION_CONNECTION_MEMORY_INCREMENT:
+ daemon->pool_increment= va_arg (ap, size_t);
+ break;
case MHD_OPTION_CONNECTION_LIMIT:
daemon->max_connections = va_arg (ap, unsigned int);
break;
@@ -2500,6 +2500,7 @@
{
/* all options taking 'size_t' */
case MHD_OPTION_CONNECTION_MEMORY_LIMIT:
+ case MHD_OPTION_CONNECTION_MEMORY_INCREMENT:
case MHD_OPTION_THREAD_STACK_SIZE:
if (MHD_YES != parse_options (daemon,
servaddr,
@@ -2786,6 +2787,7 @@
daemon->default_handler_cls = dh_cls;
daemon->max_connections = MHD_MAX_CONNECTIONS_DEFAULT;
daemon->pool_size = MHD_POOL_SIZE_DEFAULT;
+ daemon->pool_increment = MHD_BUF_INC_SIZE;
daemon->unescape_callback = &MHD_http_unescape;
daemon->connection_timeout = 0; /* no timeout */
daemon->wpipe[0] = -1;
Modified: libmicrohttpd/src/microhttpd/internal.h
===================================================================
--- libmicrohttpd/src/microhttpd/internal.h 2013-07-05 09:56:33 UTC (rev
27753)
+++ libmicrohttpd/src/microhttpd/internal.h 2013-07-05 10:12:10 UTC (rev
27754)
@@ -48,6 +48,16 @@
/**
+ * Minimum size by which MHD tries to increment read/write buffers.
+ * We usually begin with half the available pool space for the
+ * IO-buffer, but if absolutely needed we additively grow by the
+ * number of bytes given here (up to -- theoretically -- the full pool
+ * space).
+ */
+#define MHD_BUF_INC_SIZE 1024
+
+
+/**
* Handler for fatal errors.
*/
extern MHD_PanicCallback mhd_panic;
@@ -1002,6 +1012,11 @@
size_t pool_size;
/**
+ * Increment for growth of the per-connection memory pools.
+ */
+ size_t pool_increment;
+
+ /**
* Size of threads created by MHD.
*/
size_t thread_stack_size;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r27754 - in libmicrohttpd: . doc src/include src/microhttpd,
gnunet <=