aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r--src/microhttpd/daemon.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 1aa7d8d3..58bbebfc 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -73,7 +73,7 @@
73/** 73/**
74 * Default connection limit. 74 * Default connection limit.
75 */ 75 */
76#ifndef WINDOWS 76#ifndef MHD_WINSOCK_SOCKETS
77#define MHD_MAX_CONNECTIONS_DEFAULT FD_SETSIZE - 4 77#define MHD_MAX_CONNECTIONS_DEFAULT FD_SETSIZE - 4
78#else 78#else
79#define MHD_MAX_CONNECTIONS_DEFAULT FD_SETSIZE 79#define MHD_MAX_CONNECTIONS_DEFAULT FD_SETSIZE
@@ -1271,7 +1271,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1271 return MHD_NO; 1271 return MHD_NO;
1272 } 1272 }
1273 1273
1274#ifndef WINDOWS 1274#ifndef MHD_WINSOCK_SOCKETS
1275 if ( (client_socket >= FD_SETSIZE) && 1275 if ( (client_socket >= FD_SETSIZE) &&
1276 (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) ) 1276 (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) )
1277 { 1277 {
@@ -1418,7 +1418,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1418#endif 1418#endif
1419 { 1419 {
1420 /* make socket non-blocking */ 1420 /* make socket non-blocking */
1421#if !defined(WINDOWS) || defined(CYGWIN) 1421#if !defined(MHD_WINSOCK_SOCKETS)
1422 int flags = fcntl (connection->socket_fd, F_GETFL); 1422 int flags = fcntl (connection->socket_fd, F_GETFL);
1423 if ( (-1 == flags) || 1423 if ( (-1 == flags) ||
1424 (0 != fcntl (connection->socket_fd, F_SETFL, flags | O_NONBLOCK)) ) 1424 (0 != fcntl (connection->socket_fd, F_SETFL, flags | O_NONBLOCK)) )
@@ -1797,7 +1797,7 @@ static void
1797make_nonblocking_noninheritable (struct MHD_Daemon *daemon, 1797make_nonblocking_noninheritable (struct MHD_Daemon *daemon,
1798 MHD_socket sock) 1798 MHD_socket sock)
1799{ 1799{
1800#ifdef WINDOWS 1800#ifdef MHD_WINSOCK_SOCKETS
1801 DWORD dwFlags; 1801 DWORD dwFlags;
1802 unsigned long flags = 1; 1802 unsigned long flags = 1;
1803 1803
@@ -3611,7 +3611,7 @@ MHD_start_daemon_va (unsigned int flags,
3611 daemon->socket_fd = MHD_INVALID_SOCKET; 3611 daemon->socket_fd = MHD_INVALID_SOCKET;
3612 daemon->listening_address_reuse = 0; 3612 daemon->listening_address_reuse = 0;
3613 daemon->options = flags; 3613 daemon->options = flags;
3614#if WINDOWS 3614#if defined(MHD_WINSOCK_SOCKETS) || defined(CYGWIN)
3615 /* Winsock is broken with respect to 'shutdown'; 3615 /* Winsock is broken with respect to 'shutdown';
3616 this disables us calling 'shutdown' on W32. */ 3616 this disables us calling 'shutdown' on W32. */
3617 daemon->options |= MHD_USE_EPOLL_TURBO; 3617 daemon->options |= MHD_USE_EPOLL_TURBO;
@@ -3650,7 +3650,7 @@ MHD_start_daemon_va (unsigned int flags,
3650 free (daemon); 3650 free (daemon);
3651 return NULL; 3651 return NULL;
3652 } 3652 }
3653#ifndef WINDOWS 3653#ifndef MHD_WINSOCK_SOCKETS
3654 if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) && 3654 if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) &&
3655 (1 == use_pipe) && 3655 (1 == use_pipe) &&
3656 (daemon->wpipe[0] >= FD_SETSIZE) ) 3656 (daemon->wpipe[0] >= FD_SETSIZE) )
@@ -3934,7 +3934,7 @@ MHD_start_daemon_va (unsigned int flags,
3934 (http://msdn.microsoft.com/en-us/library/ms738574%28v=VS.85%29.aspx); 3934 (http://msdn.microsoft.com/en-us/library/ms738574%28v=VS.85%29.aspx);
3935 and may also be missing on older POSIX systems; good luck if you have any of those, 3935 and may also be missing on older POSIX systems; good luck if you have any of those,
3936 your IPv6 socket may then also bind against IPv4 anyway... */ 3936 your IPv6 socket may then also bind against IPv4 anyway... */
3937#ifndef WINDOWS 3937#ifndef MHD_WINSOCK_SOCKETS
3938 const int 3938 const int
3939#else 3939#else
3940 const char 3940 const char
@@ -4016,7 +4016,7 @@ MHD_start_daemon_va (unsigned int flags,
4016 { 4016 {
4017 socket_fd = daemon->socket_fd; 4017 socket_fd = daemon->socket_fd;
4018 } 4018 }
4019#ifndef WINDOWS 4019#ifndef MHD_WINSOCK_SOCKETS
4020 if ( (socket_fd >= FD_SETSIZE) && 4020 if ( (socket_fd >= FD_SETSIZE) &&
4021 (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY)) ) ) 4021 (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY)) ) )
4022 { 4022 {
@@ -4121,7 +4121,7 @@ MHD_start_daemon_va (unsigned int flags,
4121 if ( (daemon->worker_pool_size > 0) && 4121 if ( (daemon->worker_pool_size > 0) &&
4122 (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) ) 4122 (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) )
4123 { 4123 {
4124#if !defined(WINDOWS) || defined(CYGWIN) 4124#if !defined(MHD_WINSOCK_SOCKETS)
4125 int sk_flags; 4125 int sk_flags;
4126#else 4126#else
4127 unsigned long sk_flags; 4127 unsigned long sk_flags;
@@ -4140,7 +4140,7 @@ MHD_start_daemon_va (unsigned int flags,
4140 /* Accept must be non-blocking. Multiple children may wake up 4140 /* Accept must be non-blocking. Multiple children may wake up
4141 * to handle a new connection, but only one will win the race. 4141 * to handle a new connection, but only one will win the race.
4142 * The others must immediately return. */ 4142 * The others must immediately return. */
4143#if !defined(WINDOWS) || defined(CYGWIN) 4143#if !defined(MHD_WINSOCK_SOCKETS)
4144 sk_flags = fcntl (socket_fd, F_GETFL); 4144 sk_flags = fcntl (socket_fd, F_GETFL);
4145 if (sk_flags < 0) 4145 if (sk_flags < 0)
4146 goto thread_failed; 4146 goto thread_failed;
@@ -4150,7 +4150,7 @@ MHD_start_daemon_va (unsigned int flags,
4150 sk_flags = 1; 4150 sk_flags = 1;
4151 if (SOCKET_ERROR == ioctlsocket (socket_fd, FIONBIO, &sk_flags)) 4151 if (SOCKET_ERROR == ioctlsocket (socket_fd, FIONBIO, &sk_flags))
4152 goto thread_failed; 4152 goto thread_failed;
4153#endif /* WINDOWS && !CYGWIN */ 4153#endif /* MHD_WINSOCK_SOCKETS */
4154 4154
4155 /* Allocate memory for pooled objects */ 4155 /* Allocate memory for pooled objects */
4156 daemon->worker_pool = malloc (sizeof (struct MHD_Daemon) 4156 daemon->worker_pool = malloc (sizeof (struct MHD_Daemon)
@@ -4182,7 +4182,7 @@ MHD_start_daemon_va (unsigned int flags,
4182#endif 4182#endif
4183 goto thread_failed; 4183 goto thread_failed;
4184 } 4184 }
4185#ifndef WINDOWS 4185#ifndef MHD_WINSOCK_SOCKETS
4186 if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) && 4186 if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) &&
4187 (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME)) && 4187 (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME)) &&
4188 (d->wpipe[0] >= FD_SETSIZE) ) 4188 (d->wpipe[0] >= FD_SETSIZE) )
@@ -4343,7 +4343,7 @@ close_all_connections (struct MHD_Daemon *daemon)
4343 { 4343 {
4344 shutdown (pos->socket_fd, 4344 shutdown (pos->socket_fd,
4345 (pos->read_closed == MHD_YES) ? SHUT_WR : SHUT_RDWR); 4345 (pos->read_closed == MHD_YES) ? SHUT_WR : SHUT_RDWR);
4346#if WINDOWS 4346#if MHD_WINSOCK_SOCKETS
4347 if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && 4347 if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
4348 (MHD_INVALID_PIPE_ != daemon->wpipe[1]) && 4348 (MHD_INVALID_PIPE_ != daemon->wpipe[1]) &&
4349 (1 != MHD_pipe_write_ (daemon->wpipe[1], "e", 1)) ) 4349 (1 != MHD_pipe_write_ (daemon->wpipe[1], "e", 1)) )