libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit a9dcda31621696b7713db4bd89a7c02e7e4682e4
parent e9a319277b58c9d55629cdd8d34a82cc7bee640e
Author: LRN <lrn1986@gmail.com>
Date:   Mon, 12 Aug 2013 11:15:26 +0000

Use socketpair to wake up listenthread on W32

Diffstat:
Msrc/include/microhttpd.h | 1+
Msrc/microhttpd/daemon.c | 7++++++-
Msrc/microhttpd/internal.h | 1+
3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h @@ -430,6 +430,7 @@ enum MHD_FLAG * use of this option is automatic (as in, you do not even have to * specify it), if 'MHD_USE_NO_LISTEN_SOCKET' is specified. In * "external" select mode, this option is always simply ignored. + * On W32 a pair of sockets is used instead of a pipe. */ MHD_USE_PIPE_FOR_SHUTDOWN = 1024, diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -2968,7 +2968,12 @@ MHD_start_daemon_va (unsigned int flags, if (0 == (flags & (MHD_USE_SELECT_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION))) use_pipe = 0; /* useless if we are using 'external' select */ if ( (use_pipe) && - (0 != PIPE (daemon->wpipe)) ) +#ifdef WINDOWS + (0 != SOCKETPAIR (AF_INET, SOCK_STREAM, IPPROTO_TCP, daemon->wpipe)) +#else + (0 != PIPE (daemon->wpipe)) +#endif + ) { #if HAVE_MESSAGES MHD_DLOG (daemon, diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h @@ -1073,6 +1073,7 @@ struct MHD_Daemon * Pipe we use to signal shutdown, unless * 'HAVE_LISTEN_SHUTDOWN' is defined AND we have a listen * socket (which we can then 'shutdown' to stop listening). + * On W32 this is a socketpair, not a pipe. */ int wpipe[2];