GNU libmicrohttpd 0.9.77
|
implementation of MHD_action_suspend() More...
#include "internal.h"
Go to the source code of this file.
Functions | |
static enum MHD_StatusCode | suspend_action (void *cls, struct MHD_Request *request) |
const struct MHD_Action * | MHD_action_suspend (void) |
implementation of MHD_action_suspend()
Definition in file action_suspend.c.
const struct MHD_Action * MHD_action_suspend | ( | void | ) |
Suspend handling of network data for a given request. This can be used to dequeue a request from MHD's event loop for a while.
If you use this API in conjunction with a internal select or a thread pool, you must set the option MHD_USE_ITC to ensure that a resumed request is immediately processed by MHD.
Suspended requests continue to count against the total number of requests allowed (per daemon, as well as per IP, if such limits are set). Suspended requests will NOT time out; timeouts will restart when the request handling is resumed. While a request is suspended, MHD will not detect disconnects by the client.
The only safe time to suspend a request is from either a #MHD_RequestHeaderCallback, #MHD_UploadCallback, or a #MHD_RequestfetchResponseCallback. Suspending a request at any other time will cause an assertion failure.
Finally, it is an API violation to call #MHD_daemon_stop() while having suspended requests (this will at least create memory and socket leaks or lead to undefined behavior). You must explicitly resume all requests before stopping the daemon.
Definition at line 127 of file action_suspend.c.
References MHD_Action::action, NULL, and suspend_action().
|
static |
The suspend action is being run. Suspend handling of the given request.
cls | NULL |
request | the request to apply the action to |
Definition at line 37 of file action_suspend.c.
References _, MHD_Daemon::cleanup_connection_mutex, MHD_Request::connection, MHD_Daemon::connection_default_timeout, MHD_Connection::connection_timeout, MHD_Daemon::connections_head, MHD_Daemon::connections_tail, MHD_Connection::daemon, DLL_insert, DLL_remove, EDLL_remove, MHD_Daemon::event_loop_syscall, MHD_Daemon::manual_timeout_head, MHD_Daemon::manual_timeout_tail, mhd_assert, MHD_EPOLL_STATE_IN_EPOLL_SET, MHD_EPOLL_STATE_IN_EREADY_EDLL, MHD_EPOLL_STATE_SUSPENDED, MHD_mutex_lock_chk_, MHD_mutex_unlock_chk_, MHD_PANIC, MHD_Daemon::normal_timeout_head, MHD_Daemon::normal_timeout_tail, NULL, MHD_Connection::request, MHD_Connection::resuming, MHD_Connection::socket_fd, MHD_Connection::suspended, MHD_Daemon::suspended_connections_head, MHD_Daemon::suspended_connections_tail, MHD_Daemon::threading_mode, and XDLL_remove.
Referenced by MHD_action_suspend().