gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r36737 - in libmicrohttpd/src: include microhttpd
Date: Mon, 7 Dec 2015 21:51:11 +0100

Author: Karlson2k
Date: 2015-12-07 21:51:11 +0100 (Mon, 07 Dec 2015)
New Revision: 36737

Modified:
   libmicrohttpd/src/include/platform.h
   libmicrohttpd/src/microhttpd/daemon.c
Log:
Handle redefined FD_SETSIZE and really redefine FD_SETSIZE for W32

Modified: libmicrohttpd/src/include/platform.h
===================================================================
--- libmicrohttpd/src/include/platform.h        2015-12-07 10:45:42 UTC (rev 
36736)
+++ libmicrohttpd/src/include/platform.h        2015-12-07 20:51:11 UTC (rev 
36737)
@@ -57,6 +57,32 @@
 #endif
 #endif /* BUILDING_MHD_LIB */
 
+
+#ifdef FD_SETSIZE
+/* FD_SETSIZE defined in command line or in MHD_config.h */
+/* Some platforms (FreeBSD, Solaris, W32) allow to override
+   default FD_SETSIZE by defining it before including
+   headers. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+/* Default FD_SETSIZE value for WinSock */
+#define MHD_SYS_DEFAULT_FD_SETSIZE 64
+#elif defined(__sun) && defined(_LP64)
+/* Default FD_SETSIZE value for 64bit Solaris since version 7
+   and SunOS since version 2.7 */
+#define MHD_SYS_DEFAULT_FD_SETSIZE 65536
+#else  /* all other platforms */
+/* Default FD_SETSIZE value for most platforms */
+#define MHD_SYS_DEFAULT_FD_SETSIZE 1024
+#endif /* all other platforms */
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+/* Platform with WinSock and without overridden FD_SETSIZE */
+#define FD_SETSIZE 2048 /* Override default small value */
+#define MHD_SYS_DEFAULT_FD_SETSIZE 64
+#else
+/* Use system default value */
+#define MHD_SYS_DEFAULT_FD_SETSIZE FD_SETSIZE
+#endif /* FD_SETSIZE */
+
 #define _XOPEN_SOURCE_EXTENDED  1
 #if OS390
 #define _OPEN_THREADS
@@ -154,6 +180,10 @@
 #include <arpa/inet.h>
 #endif
 
+#if defined(__CYGWIN__) && !defined(_SYS_TYPES_FD_SET)
+/* Do not define __USE_W32_SOCKETS under Cygwin! */
+#error Cygwin with winsock fd_set is not supported
+#endif
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #include <ws2tcpip.h>
@@ -175,20 +205,21 @@
 #define _SSIZE_T_DEFINED
 typedef intptr_t ssize_t;
 #endif /* !_SSIZE_T_DEFINED */
+
 #ifndef MHD_SOCKET_DEFINED
 /**
  * MHD_socket is type for socket FDs
  */
-#if !defined(_WIN32) || defined(_SYS_TYPES_FD_SET)
+#if !defined(_WIN32) || defined(__CYGWIN__)
 #define MHD_POSIX_SOCKETS 1
 typedef int MHD_socket;
 #define MHD_INVALID_SOCKET (-1)
-#else /* !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) */
+#else  /* defined(_WIN32) && !defined(__CYGWIN__) */
 #define MHD_WINSOCK_SOCKETS 1
 #include <winsock2.h>
 typedef SOCKET MHD_socket;
 #define MHD_INVALID_SOCKET (INVALID_SOCKET)
-#endif /* !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) */
+#endif /* defined(_WIN32) && !defined(__CYGWIN__) */
 #define MHD_SOCKET_DEFINED 1
 #endif /* MHD_SOCKET_DEFINED */
 

Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c       2015-12-07 10:45:42 UTC (rev 
36736)
+++ libmicrohttpd/src/microhttpd/daemon.c       2015-12-07 20:51:11 UTC (rev 
36737)
@@ -24,13 +24,6 @@
  * @author Daniel Pittman
  * @author Christian Grothoff
  */
-#if defined(MHD_WINSOCK_SOCKETS)
-/* override small default value */
-#define FD_SETSIZE 1024
-#define MHD_DEFAULT_FD_SETSIZE 64
-#else
-#define MHD_DEFAULT_FD_SETSIZE FD_SETSIZE
-#endif
 #include "platform.h"
 #include "internal.h"
 #include "response.h"
@@ -75,7 +68,7 @@
  * Default connection limit.
  */
 #ifndef MHD_WINSOCK_SOCKETS
-#define MHD_MAX_CONNECTIONS_DEFAULT FD_SETSIZE - 4
+#define MHD_MAX_CONNECTIONS_DEFAULT (FD_SETSIZE - 4)
 #else
 #define MHD_MAX_CONNECTIONS_DEFAULT FD_SETSIZE
 #endif
@@ -684,7 +677,7 @@
 {
   return MHD_get_fdset2(daemon, read_fd_set,
       write_fd_set, except_fd_set,
-      max_fd, MHD_DEFAULT_FD_SETSIZE);
+      max_fd, MHD_SYS_DEFAULT_FD_SETSIZE);
 }
 
 /**




reply via email to

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