httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From taka...@apache.org
Subject svn commit: r1601943 - in /httpd/httpd/trunk: include/ap_mmn.h include/ap_mpm.h include/mpm_common.h modules/proxy/mod_proxy_wstunnel.c server/mpm/event/event.c server/mpm_common.c
Date Wed, 11 Jun 2014 16:39:34 GMT
Author: takashi
Date: Wed Jun 11 16:39:34 2014
New Revision: 1601943

URL: http://svn.apache.org/r1601943
Log:
Socket event callback now takes pollfd.
User (e.g. mod_proxy_wstunnel) can know
which socket is ready.

Modified:
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/include/ap_mpm.h
    httpd/httpd/trunk/include/mpm_common.h
    httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c
    httpd/httpd/trunk/server/mpm/event/event.c
    httpd/httpd/trunk/server/mpm_common.c

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1601943&r1=1601942&r2=1601943&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Wed Jun 11 16:39:34 2014
@@ -457,14 +457,18 @@
  * 20140207.6 (2.5.0-dev)  Added ap_log_common().
  * 20140207.7 (2.5.0-dev)  Added ap_force_set_tz().
  * 20140207.8 (2.5.0-dev)  Added ap_shutdown_conn().
+ * 20140611.0 (2.5.0-dev)  Add ap_mpm_socket_callback_fn_t.
+                           Changes 3rd argument's type of
+                           ap_mpm_register_socket_callback and 
+                           ap_mpm_register_socket_callback_timeout.
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
 
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20140207
+#define MODULE_MAGIC_NUMBER_MAJOR 20140611
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 8                  /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 0                  /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/trunk/include/ap_mpm.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mpm.h?rev=1601943&r1=1601942&r2=1601943&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mpm.h (original)
+++ httpd/httpd/trunk/include/ap_mpm.h Wed Jun 11 16:39:34 2014
@@ -198,6 +198,7 @@ AP_DECLARE(apr_status_t) ap_mpm_query(in
 /** @} */
 
 typedef void (ap_mpm_callback_fn_t)(void *baton);
+typedef void (ap_mpm_socket_callback_fn_t)(void *baton, const apr_pollfd_t *pdf);
 
 /* only added support in the Event MPM....  check for APR_ENOTIMPL */
 AP_DECLARE(apr_status_t) ap_mpm_resume_suspended(conn_rec *c);
@@ -222,7 +223,7 @@ AP_DECLARE(apr_status_t) ap_mpm_register
 AP_DECLARE(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,
+                                                         ap_mpm_socket_callback_fn_t *cbfn,
                                                          void *baton);
  /**
  * Register a callback on the readability or writability on a group of sockets, with a timeout
@@ -243,7 +244,7 @@ AP_DECLARE(apr_status_t) ap_mpm_register
 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_socket_callback_fn_t *cbfn,
                                                          ap_mpm_callback_fn_t *tofn,
                                                          void *baton,
                                                          apr_time_t timeout);

Modified: httpd/httpd/trunk/include/mpm_common.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/mpm_common.h?rev=1601943&r1=1601942&r2=1601943&view=diff
==============================================================================
--- httpd/httpd/trunk/include/mpm_common.h (original)
+++ httpd/httpd/trunk/include/mpm_common.h Wed Jun 11 16:39:34 2014
@@ -427,7 +427,7 @@ AP_DECLARE_HOOK(apr_status_t, mpm_regist
  * @ingroup hooks
  */
 AP_DECLARE_HOOK(apr_status_t, mpm_register_socket_callback,
-                (apr_socket_t **s, apr_pool_t *p, int for_read, ap_mpm_callback_fn_t *cbfn,
void *baton))
+                (apr_socket_t **s, apr_pool_t *p, int for_read, ap_mpm_socket_callback_fn_t
*cbfn, void *baton))
 
 /* register the specified callback, with timeout 
  * @ingroup hooks
@@ -435,7 +435,7 @@ AP_DECLARE_HOOK(apr_status_t, mpm_regist
  */
 AP_DECLARE_HOOK(apr_status_t, mpm_register_socket_callback_timeout,
                 (apr_socket_t **s, apr_pool_t *p, int for_read, 
-                 ap_mpm_callback_fn_t *cbfn,  
+                 ap_mpm_socket_callback_fn_t *cbfn,  
                  ap_mpm_callback_fn_t *tofn, 
                  void *baton, 
                  apr_time_t timeout))

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c?rev=1601943&r1=1601942&r2=1601943&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c Wed Jun 11 16:39:34 2014
@@ -38,7 +38,7 @@ typedef struct ws_baton_t {
 
 static apr_status_t proxy_wstunnel_transfer(request_rec *r, conn_rec *c_i, conn_rec *c_o,
                                      apr_bucket_brigade *bb, char *name);
-static void proxy_wstunnel_callback(void *b);
+static void proxy_wstunnel_callback(void *b, const apr_pollfd_t *dummy);
 
 static int proxy_wstunnel_pump(ws_baton_t *baton, apr_time_t timeout, int try_async) {
     request_rec *r = baton->r;
@@ -164,7 +164,7 @@ static void proxy_wstunnel_cancel_callba
  *  We don't need the invoke_mtx, since we never put multiple callback events
  *  in the queue.
  */
-static void proxy_wstunnel_callback(void *b) { 
+static void proxy_wstunnel_callback(void *b, const apr_pollfd_t *dummy) { 
     int status;
     apr_socket_t *sockets[3] = {NULL, NULL, NULL};
     ws_baton_t *baton = (ws_baton_t*)b;

Modified: httpd/httpd/trunk/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1601943&r1=1601942&r2=1601943&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/event/event.c Wed Jun 11 16:39:34 2014
@@ -320,7 +320,7 @@ typedef struct
 
 typedef struct
 {
- ap_mpm_callback_fn_t *cbfunc;
+ ap_mpm_socket_callback_fn_t *cbfunc;
  void *user_baton; 
  apr_pollfd_t **pfds;
  int nsock;
@@ -1488,7 +1488,7 @@ static apr_status_t event_register_timed
 static apr_status_t event_register_socket_callback_ex(apr_socket_t **s, 
                                                   apr_pool_t *p, 
                                                   int for_read,
-                                                  ap_mpm_callback_fn_t *cbfn,
+                                                  ap_mpm_socket_callback_fn_t *cbfn,
                                                   ap_mpm_callback_fn_t *tofn,
                                                   void *baton, 
                                                   apr_time_t timeout)
@@ -1536,7 +1536,7 @@ static apr_status_t event_register_socke
 static apr_status_t event_register_socket_callback(apr_socket_t **s, 
                                                   apr_pool_t *p, 
                                                   int for_read,
-                                                  ap_mpm_callback_fn_t *cbfn,
+                                                  ap_mpm_socket_callback_fn_t *cbfn,
                                                   void *baton)
 {
     return event_register_socket_callback_ex(s, p, for_read, 
@@ -1657,6 +1657,12 @@ static void process_timeout_queue(struct
     apr_thread_mutex_lock(timeout_mutex);
 }
 
+static void socket_callback_wrapper(void *baton){
+    const apr_pollfd_t *out_pfd = (const apr_pollfd_t *)baton;
+    socket_callback_baton_t *scb_baton = (socket_callback_baton_t *) ((listener_poll_type
*) out_pfd->client_data)->baton;
+    scb_baton->cbfunc(scb_baton->user_baton, out_pfd);
+}
+
 static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy)
 {
     timer_event_t *ep;
@@ -1974,8 +1980,8 @@ static void * APR_THREAD_FUNC listener_t
                 if (!(baton->signaled)) { 
                     baton->signaled = 1;
                     te = event_get_timer_event(-1 /* fake timer */, 
-                                               baton->cbfunc, 
-                                               baton->user_baton, 
+                                               socket_callback_wrapper, 
+                                               (apr_pollfd_t *)out_pfd,
                                                0, /* don't insert it */
                                                NULL /* no associated socket callback */);
                     /* remove other sockets in my set */

Modified: httpd/httpd/trunk/server/mpm_common.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_common.c?rev=1601943&r1=1601942&r2=1601943&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_common.c (original)
+++ httpd/httpd/trunk/server/mpm_common.c Wed Jun 11 16:39:34 2014
@@ -108,10 +108,10 @@ AP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t
                             (conn_rec *c),
                             (c), APR_ENOTIMPL)
 AP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t, mpm_register_socket_callback,
-                            (apr_socket_t **s, apr_pool_t *p, int for_read, ap_mpm_callback_fn_t
*cbfn, void *baton),
+                            (apr_socket_t **s, apr_pool_t *p, int for_read, ap_mpm_socket_callback_fn_t
*cbfn, void *baton),
                             (s, p, for_read, cbfn, baton), APR_ENOTIMPL)
 AP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t, 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),
+                            (apr_socket_t **s, apr_pool_t *p, int for_read, ap_mpm_socket_callback_fn_t
*cbfn, ap_mpm_callback_fn_t *tofn, void *baton, apr_time_t timeout),
                             (s, p, for_read, cbfn, tofn, baton, timeout), APR_ENOTIMPL)
 AP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t, mpm_unregister_socket_callback,
                             (apr_socket_t **s, apr_pool_t *p),
@@ -559,14 +559,14 @@ AP_DECLARE(apr_status_t) ap_mpm_register
 {
     return ap_run_mpm_register_timed_callback(t, cbfn, baton);
 }
-AP_DECLARE(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, apr_pool_t *p,
int for_read, ap_mpm_socket_callback_fn_t *cbfn, void *baton)
 {
     return ap_run_mpm_register_socket_callback(s, p, for_read, cbfn, baton);
 }
 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_socket_callback_fn_t
*cbfn, 
                                                                  ap_mpm_callback_fn_t *tofn,

                                                                  void *baton, 
                                                                  apr_time_t timeout)



Mime
View raw message