gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r36745 - in libmicrohttpd/src: include microhttpd


From: gnunet
Subject: [GNUnet-SVN] r36745 - in libmicrohttpd/src: include microhttpd
Date: Tue, 8 Dec 2015 21:48:44 +0100

Author: Karlson2k
Date: 2015-12-08 21:48:44 +0100 (Tue, 08 Dec 2015)
New Revision: 36745

Modified:
   libmicrohttpd/src/include/microhttpd.h
   libmicrohttpd/src/microhttpd/daemon.c
   libmicrohttpd/src/microhttpd/internal.h
Log:
Change default listen backlog size from 32 to SOMAXCONN, allow to specify 
required listen backlog size

Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h      2015-12-08 20:02:43 UTC (rev 
36744)
+++ libmicrohttpd/src/include/microhttpd.h      2015-12-08 20:48:44 UTC (rev 
36745)
@@ -130,7 +130,7 @@
  * Current version of the library.
  * 0x01093001 = 1.9.30-1.
  */
-#define MHD_VERSION 0x00094701
+#define MHD_VERSION 0x00094703
 
 /**
  * MHD-internal return code for "YES".
@@ -967,8 +967,15 @@
    * pointer to a closure to pass to the request completed callback.
    * The second pointer maybe NULL.
    */
-  MHD_OPTION_NOTIFY_CONNECTION = 27
+  MHD_OPTION_NOTIFY_CONNECTION = 27,
 
+  /**
+   * Allow to change maximum length of the queue of pending connections on
+   * listen socket. If not present than default platform-specific SOMAXCONN
+   * value is used. This option should be followed by an `unsigned int`
+   * argument.
+   */
+  MHD_OPTION_LISTEN_BACKLOG_SIZE = 28
 };
 
 

Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c       2015-12-08 20:02:43 UTC (rev 
36744)
+++ libmicrohttpd/src/microhttpd/daemon.c       2015-12-08 20:48:44 UTC (rev 
36745)
@@ -3397,6 +3397,9 @@
        case MHD_OPTION_LISTENING_ADDRESS_REUSE:
          daemon->listening_address_reuse = va_arg (ap, unsigned int) ? 1 : -1;
          break;
+       case MHD_OPTION_LISTEN_BACKLOG_SIZE:
+         daemon->listen_backlog_size = va_arg (ap, unsigned int);
+         break;
        case MHD_OPTION_ARRAY:
          oa = va_arg (ap, struct MHD_OptionItem*);
          i = 0;
@@ -3423,6 +3426,7 @@
                case MHD_OPTION_THREAD_POOL_SIZE:
                 case MHD_OPTION_TCP_FASTOPEN_QUEUE_SIZE:
                case MHD_OPTION_LISTENING_ADDRESS_REUSE:
+               case MHD_OPTION_LISTEN_BACKLOG_SIZE:
                  if (MHD_YES != parse_options (daemon,
                                                servaddr,
                                                opt,
@@ -3731,6 +3735,11 @@
   daemon->connection_timeout = 0;       /* no timeout */
   daemon->wpipe[0] = MHD_INVALID_PIPE_;
   daemon->wpipe[1] = MHD_INVALID_PIPE_;
+#ifdef SOMAXCONN
+  daemon->listen_backlog_size = SOMAXCONN;
+#else  /* !SOMAXCONN */
+  daemon->listen_backlog_size = 511; /* should be safe value */
+#endif /* !SOMAXCONN */
 #if HAVE_MESSAGES
   daemon->custom_error_log = (MHD_LogCallback) &vfprintf;
   daemon->custom_error_log_cls = stderr;
@@ -4098,7 +4107,7 @@
            }
        }
 #endif
-      if (listen (socket_fd, 32) < 0)
+      if (listen (socket_fd, daemon->listen_backlog_size) < 0)
        {
 #if HAVE_MESSAGES
           MHD_DLOG (daemon,

Modified: libmicrohttpd/src/microhttpd/internal.h
===================================================================
--- libmicrohttpd/src/microhttpd/internal.h     2015-12-08 20:02:43 UTC (rev 
36744)
+++ libmicrohttpd/src/microhttpd/internal.h     2015-12-08 20:48:44 UTC (rev 
36745)
@@ -1301,6 +1301,11 @@
    */
   unsigned int fastopen_queue_size;
 #endif
+
+  /**
+   * The size of queue for listen socket.
+   */
+  unsigned int listen_backlog_size;
 };
 
 




reply via email to

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