commit a50a5626c08df674043907b562f90306589847a4
parent 9569a609edc067b018be8182424e54de41df2fdc
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 12 Aug 2013 21:56:49 +0000
document #2983
Diffstat:
3 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -2,7 +2,7 @@ Mon Aug 12 23:51:18 CEST 2013
Updated manual, documenting W32 select/shutdown issue. -CG
Sat Aug 10 21:01:18 CEST 2013
- Trying to fix #2983 (untested). -CG
+ Fixed #2983. -CG
Sat Aug 10 20:39:27 CEST 2013
Use 'errno' to indicate why 'MHD_add_connection' failed
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
@@ -1322,7 +1322,12 @@ managed by MHD. This API is usually not needed (since
MHD will accept inbound connections on the server socket).
Use this API in special cases, for example if your HTTP
server is behind NAT and needs to connect out to the
-HTTP client.
+HTTP client, or if you are building a proxy.
+
+If you use this API in conjunction with a internal select or a thread
+pool, you must set the option @code{MHD_USE_PIPE_FOR_SHUTDOWN} to
+ensure that the freshly added connection is immediately processed by
+MHD.
The given client socket will be managed (and closed!) by MHD after
this call and must no longer be used directly by the application
@@ -1342,7 +1347,8 @@ number of bytes in addr
This function will return @code{MHD_YES} on success,
@code{MHD_NO} if this daemon could
not handle the connection (i.e. malloc failed, etc).
-The socket will be closed in any case.
+The socket will be closed in any case; 'errno' is set
+to indicate further details about the error.
@end deftypefun
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
@@ -431,6 +431,9 @@ enum MHD_FLAG
* 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.
+ *
+ * You must also use this option if you use internal select mode
+ * or a thread pool in conjunction with 'MHD_add_connection'.
*/
MHD_USE_PIPE_FOR_SHUTDOWN = 1024,
@@ -1208,12 +1211,16 @@ MHD_stop_daemon (struct MHD_Daemon *daemon);
/**
- * Add another client connection to the set of connections
- * managed by MHD. This API is usually not needed (since
- * MHD will accept inbound connections on the server socket).
- * Use this API in special cases, for example if your HTTP
- * server is behind NAT and needs to connect out to the
- * HTTP client.
+ * Add another client connection to the set of connections managed by
+ * MHD. This API is usually not needed (since MHD will accept inbound
+ * connections on the server socket). Use this API in special cases,
+ * for example if your HTTP server is behind NAT and needs to connect
+ * out to the HTTP client, or if you are building a proxy.
+ *
+ * If you use this API in conjunction with a internal select or a
+ * thread pool, you must set the option
+ * @code{MHD_USE_PIPE_FOR_SHUTDOWN} to ensure that the freshly added
+ * connection is immediately processed by MHD.
*
* The given client socket will be managed (and closed!) by MHD after
* this call and must no longer be used directly by the application