diff options
Diffstat (limited to 'src/daemon/daemon.c')
-rw-r--r-- | src/daemon/daemon.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 09a37255..19c614a1 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c | |||
@@ -171,7 +171,7 @@ MHD_get_fdset (struct MHD_Daemon *daemon, | |||
171 | } | 171 | } |
172 | #if DEBUG_CONNECT | 172 | #if DEBUG_CONNECT |
173 | MHD_DLOG (daemon, "Maximum socket in select set: %d\n", *max_fd); | 173 | MHD_DLOG (daemon, "Maximum socket in select set: %d\n", *max_fd); |
174 | #endif | 174 | #endif |
175 | return MHD_YES; | 175 | return MHD_YES; |
176 | } | 176 | } |
177 | 177 | ||
@@ -264,7 +264,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon) | |||
264 | socklen_t addrlen; | 264 | socklen_t addrlen; |
265 | int s; | 265 | int s; |
266 | #if OSX | 266 | #if OSX |
267 | static int on=1; | 267 | static int on = 1; |
268 | #endif | 268 | #endif |
269 | 269 | ||
270 | 270 | ||
@@ -287,7 +287,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon) | |||
287 | } | 287 | } |
288 | #if DEBUG_CONNECT | 288 | #if DEBUG_CONNECT |
289 | MHD_DLOG (daemon, "Accepted connection on socket %d\n", s); | 289 | MHD_DLOG (daemon, "Accepted connection on socket %d\n", s); |
290 | #endif | 290 | #endif |
291 | if (daemon->max_connections == 0) | 291 | if (daemon->max_connections == 0) |
292 | { | 292 | { |
293 | /* above connection limit - reject */ | 293 | /* above connection limit - reject */ |
@@ -314,11 +314,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon) | |||
314 | #if OSX | 314 | #if OSX |
315 | #ifdef SOL_SOCKET | 315 | #ifdef SOL_SOCKET |
316 | #ifdef SO_NOSIGPIPE | 316 | #ifdef SO_NOSIGPIPE |
317 | setsockopt(s, | 317 | setsockopt (s, SOL_SOCKET, SO_NOSIGPIPE, &on, sizeof (on)); |
318 | SOL_SOCKET, | ||
319 | SO_NOSIGPIPE, | ||
320 | &on, | ||
321 | sizeof(on)); | ||
322 | #endif | 318 | #endif |
323 | #endif | 319 | #endif |
324 | #endif | 320 | #endif |
@@ -437,8 +433,9 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon) | |||
437 | continue; | 433 | continue; |
438 | } | 434 | } |
439 | 435 | ||
440 | if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && | 436 | if ((0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && |
441 | ((pos->have_received_headers == MHD_YES) && (pos->response == NULL)) ) | 437 | ((pos->have_received_headers == MHD_YES) |
438 | && (pos->response == NULL))) | ||
442 | MHD_call_connection_handler (pos); | 439 | MHD_call_connection_handler (pos); |
443 | 440 | ||
444 | prev = pos; | 441 | prev = pos; |
@@ -680,11 +677,12 @@ MHD_start_daemon (unsigned int options, | |||
680 | if ((SETSOCKOPT (socket_fd, | 677 | if ((SETSOCKOPT (socket_fd, |
681 | SOL_SOCKET, | 678 | SOL_SOCKET, |
682 | SO_REUSEADDR, | 679 | SO_REUSEADDR, |
683 | &on, sizeof (on)) < 0) && (options & MHD_USE_DEBUG) != 0) { | 680 | &on, sizeof (on)) < 0) && (options & MHD_USE_DEBUG) != 0) |
681 | { | ||
684 | #if HAVE_MESSAGES | 682 | #if HAVE_MESSAGES |
685 | fprintf (stderr, "setsockopt failed: %s\n", STRERROR (errno)); | 683 | fprintf (stderr, "setsockopt failed: %s\n", STRERROR (errno)); |
686 | #endif | 684 | #endif |
687 | } | 685 | } |
688 | if ((options & MHD_USE_IPv6) != 0) | 686 | if ((options & MHD_USE_IPv6) != 0) |
689 | { | 687 | { |
690 | memset (&servaddr6, 0, sizeof (struct sockaddr_in6)); | 688 | memset (&servaddr6, 0, sizeof (struct sockaddr_in6)); |