aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/microhttpd/daemon.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 2c2d971a..e9a978aa 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -4114,24 +4114,6 @@ MHD_start_daemon_va (unsigned int flags,
4114 } 4114 }
4115 } 4115 }
4116#endif 4116#endif
4117 if (MHD_NO == make_nonblocking (daemon, socket_fd))
4118 {
4119#ifdef HAVE_MESSAGES
4120 MHD_DLOG (daemon,
4121 "Failed to make listen socket non-blocking: %s\n",
4122 MHD_socket_last_strerr_ ());
4123#endif /* HAVE_MESSAGES */
4124 if (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY) ||
4125 daemon->worker_pool_size > 0)
4126 {
4127 /* Accept must be non-blocking. Multiple children may wake up
4128 * to handle a new connection, but only one will win the race.
4129 * The others must immediately return. */
4130 if (0 != MHD_socket_close_ (socket_fd))
4131 MHD_PANIC ("close failed\n");
4132 goto free_and_fail;
4133 }
4134 }
4135 if (listen (socket_fd, daemon->listen_backlog_size) < 0) 4117 if (listen (socket_fd, daemon->listen_backlog_size) < 0)
4136 { 4118 {
4137#ifdef HAVE_MESSAGES 4119#ifdef HAVE_MESSAGES
@@ -4148,6 +4130,20 @@ MHD_start_daemon_va (unsigned int flags,
4148 { 4130 {
4149 socket_fd = daemon->socket_fd; 4131 socket_fd = daemon->socket_fd;
4150 } 4132 }
4133
4134 if (MHD_NO == make_nonblocking (daemon, socket_fd))
4135 {
4136 if (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY) ||
4137 daemon->worker_pool_size > 0)
4138 {
4139 /* Accept must be non-blocking. Multiple children may wake up
4140 * to handle a new connection, but only one will win the race.
4141 * The others must immediately return. */
4142 if (0 != MHD_socket_close_ (socket_fd))
4143 MHD_PANIC ("close failed\n");
4144 goto free_and_fail;
4145 }
4146 }
4151#ifndef MHD_WINSOCK_SOCKETS 4147#ifndef MHD_WINSOCK_SOCKETS
4152 if ( (socket_fd >= FD_SETSIZE) && 4148 if ( (socket_fd >= FD_SETSIZE) &&
4153 (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY)) ) ) 4149 (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY)) ) )