commit 8a4e48c6f4ac13e71fdb2a65c0d5ce3a9d65db45
parent de6e50d00eacf8895c33351572381948aa5079a3
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 17 May 2016 11:37:54 +0000
add MHD_CONNECTION_INFO_CONNECTION_SUSPENDED
Diffstat:
4 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,7 @@
+Tue May 17 13:32:21 CEST 2016
+ Allow clients to determine whether a connection is suspended;
+ introduces MHD_CONNECTION_INFO_CONNECTION_SUSPENDED. -CG/FC
+
Sun May 15 12:17:25 CEST 2016
Fix handling system or process resource limit exhaustion upon
accept(). -CG/CP
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
@@ -2119,6 +2119,10 @@ to resume a suspended connection at any time. Calling this function
on a connection that was not previously suspended will result in
undefined behavior.
+You can check whether a connection is currently suspended using
+@code{MHD_get_connection_info} by querying for
+@code{MHD_CONNECTION_INFO_CONNECTION_SUSPENDED}.
+
@table @var
@item connection
the connection to resume
@@ -2637,6 +2641,11 @@ automatically (if the platform supports it). As the connection
callbacks are invoked in between, those might be used to set different
values for TCP-CORK and TCP-NODELAY in the meantime.
+@item MHD_CONNECTION_INFO_CONNECTION_SUSPENDED
+Returns pointer to an integer that is @code{MHD_YES} if the connection
+is currently suspended (and thus can be safely resumed) and
+@code{MHD_NO} otherwise.
+
@item MHD_CONNECTION_INFO_SOCKET_CONTEXT
Returns the client-specific pointer to a @code{void *} that was
(possibly) set during a @code{MHD_NotifyConnectionCallback} when the
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
@@ -1157,6 +1157,11 @@ union MHD_ConnectionInfo
int /* enum gnutls_protocol */ protocol;
/**
+ * The suspended status of a connection.
+ */
+ int /* MHD_YES or MHD_NO */ suspended;
+
+ /**
* Connect socket
*/
MHD_socket connect_fd;
@@ -1255,8 +1260,13 @@ enum MHD_ConnectionInfoType
* fresh for each HTTP request, while the "socket_context" is fresh
* for each socket.
*/
- MHD_CONNECTION_INFO_SOCKET_CONTEXT
+ MHD_CONNECTION_INFO_SOCKET_CONTEXT,
+ /**
+ * Check wheter the connection is suspended.
+ * @ingroup request
+ */
+ MHD_CONNECTION_INFO_CONNECTION_SUSPENDED
};
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
@@ -3013,6 +3013,8 @@ MHD_get_connection_info (struct MHD_Connection *connection,
return (const union MHD_ConnectionInfo *) &connection->socket_fd;
case MHD_CONNECTION_INFO_SOCKET_CONTEXT:
return (const union MHD_ConnectionInfo *) &connection->socket_context;
+ case MHD_CONNECTION_INFO_CONNECTION_SUSPENDED:
+ return (const union MHD_ConnectionInfo *) &connection->suspended;
default:
return NULL;
};