summaryrefslogtreecommitdiffstats
path: root/include/ap_mpm.h
diff options
context:
space:
mode:
authorEric Covener <covener@apache.org>2014-05-11 22:41:45 +0200
committerEric Covener <covener@apache.org>2014-05-11 22:41:45 +0200
commitd758951456f57f3496aa4d7855a043eb41f74f07 (patch)
treea526e108dd14409104194998be66505467a7ed05 /include/ap_mpm.h
parentstop setting context info for AliasMatch. These concepts do not really map (diff)
downloadapache2-d758951456f57f3496aa4d7855a043eb41f74f07.tar.xz
apache2-d758951456f57f3496aa4d7855a043eb41f74f07.zip
Extend the socket callbacks in event to allow a timeout on the I/O callback.
When a socket callback has a timeout, an associated timer event is used to remove the sockets from the pollset and call a timeout function. * This includes a noteworthy change to the main event loop. Previously, we would call epoll, then process the timer events, then iterate through the poll results. After this patch, the timer events are processed before the poll() a _non-queued_ action can change the pollset conents (a users timed callback function conversely could easily sit in a queue while the main thread continues down into epoll) * timer events can now have sockets associated with them, those sockets are removed from the pollset when the timer event fires w/o a queue to the worker. * timer events now have a canceled flag that can be toggled without locking the timer list. * Drop the severity of some wstunnel messages from DEBUG to TRACE1 * Lift the restriction on using asynchronous websockets connections but having an idle timeout git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1593857 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include/ap_mpm.h')
-rw-r--r--include/ap_mpm.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/include/ap_mpm.h b/include/ap_mpm.h
index ba7a95b0f5..d851f35582 100644
--- a/include/ap_mpm.h
+++ b/include/ap_mpm.h
@@ -213,7 +213,6 @@ AP_DECLARE(apr_status_t) ap_mpm_register_timed_callback(apr_time_t t,
* APR_ENOTIMPL if no asynch support, or an apr_pollset_add error.
* @remark When activity is found on any 1 socket in the list, all are removed
* from the pollset and only 1 callback is issued.
- * @fn apr_status_t ap_mpm_register_socket_callback(apr_socket_t **s, apr_pool_t *p, int for_read, ap_mpm_callback_fn_t *cbfn, void *baton)
*/
AP_DECLARE(apr_status_t) ap_mpm_register_socket_callback(apr_socket_t **s,
@@ -221,6 +220,30 @@ AP_DECLARE(apr_status_t) ap_mpm_register_socket_callback(apr_socket_t **s,
int for_read,
ap_mpm_callback_fn_t *cbfn,
void *baton);
+ /**
+ * Register a callback on the readability or writability on a group of sockets, with a timeout
+ * @param s Null-terminated list of sockets
+ * @param p pool for use between registration and callback
+ * @param for_read Whether the sockets are monitored for read or writability
+ * @param cbfn The callback function
+ * @param tofn The callback function if the timeout expires
+ * @param baton userdata for the callback function
+ * @param timeout timeout for I/O in microseconds, unlimited if <= 0
+ * @return APR_SUCCESS if all sockets could be added to a pollset,
+ * APR_ENOTIMPL if no asynch support, or an apr_pollset_add error.
+ * @remark When activity is found on any 1 socket in the list, all are removed
+ * from the pollset and only 1 callback is issued.
+ * @remark For each call, only one of tofn or cbfn will be called, never both.
+ */
+
+AP_DECLARE(apr_status_t) ap_mpm_register_socket_callback_timeout(apr_socket_t **s,
+ apr_pool_t *p,
+ int for_read,
+ ap_mpm_callback_fn_t *cbfn,
+ ap_mpm_callback_fn_t *tofn,
+ void *baton,
+ apr_time_t timeout);
+
AP_DECLARE(apr_status_t) ap_mpm_unregister_socket_callback(apr_socket_t **s,
apr_pool_t *p);