httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From taka...@apache.org
Subject svn commit: r1605946 - 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 Fri, 27 Jun 2014 04:17:31 GMT
Author: takashi
Date: Fri Jun 27 04:17:30 2014
New Revision: 1605946

URL: http://svn.apache.org/r1605946
Log:
Revert r1601943, r1602058, r1605307 (socket callback returning pollfds)
Revert r1605369 (wstunnel refactoring)

per discassion on dev@httpd.a.o thread Message-ID:
<CALK=YjN9HfThP_k_rF9iJPcUhcQk9sNOaDPxZNG+HcJNWS4ZAQ@mail.gmail.com>

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=1605946&r1=1605945&r2=1605946&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Fri Jun 27 04:17:30 2014
@@ -462,14 +462,15 @@
                            ap_mpm_register_socket_callback and 
                            ap_mpm_register_socket_callback_timeout.
  * 20140611.1 (2.5.0-dev)  Add ap_proxy_connect_uds().
+ * 20140627.0 (2.5.0-dev)  Revert 20140611.0 change.
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
 
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20140611
+#define MODULE_MAGIC_NUMBER_MAJOR 20140627
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 1                  /* 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=1605946&r1=1605945&r2=1605946&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mpm.h (original)
+++ httpd/httpd/trunk/include/ap_mpm.h Fri Jun 27 04:17:30 2014
@@ -198,7 +198,6 @@ 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 *pfd);
 
 /* only added support in the Event MPM....  check for APR_ENOTIMPL */
 AP_DECLARE(apr_status_t) ap_mpm_resume_suspended(conn_rec *c);
@@ -223,7 +222,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_socket_callback_fn_t *cbfn,
+                                                         ap_mpm_callback_fn_t *cbfn,
                                                          void *baton);
  /**
  * Register a callback on the readability or writability on a group of sockets, with a timeout
@@ -244,7 +243,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_socket_callback_fn_t *cbfn,
+                                                         ap_mpm_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=1605946&r1=1605945&r2=1605946&view=diff
==============================================================================
--- httpd/httpd/trunk/include/mpm_common.h (original)
+++ httpd/httpd/trunk/include/mpm_common.h Fri Jun 27 04:17:30 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_socket_callback_fn_t
*cbfn, void *baton))
+                (apr_socket_t **s, apr_pool_t *p, int for_read, ap_mpm_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_socket_callback_fn_t *cbfn,  
+                 ap_mpm_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=1605946&r1=1605945&r2=1605946&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c Fri Jun 27 04:17:30 2014
@@ -38,68 +38,21 @@ 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, const apr_pollfd_t *pfd);
+static void proxy_wstunnel_callback(void *b);
 
-static apr_status_t proxy_wstunnel_pump2(ws_baton_t *baton, const apr_pollfd_t *pfd){
+static int proxy_wstunnel_pump(ws_baton_t *baton, apr_time_t timeout, int try_async) {
     request_rec *r = baton->r;
     conn_rec *c = r->connection;
     proxy_conn_rec *conn = baton->proxy_connrec;
     apr_socket_t *sock = conn->sock;
     conn_rec *backconn = conn->connection;
-    apr_int16_t pollevent;
-    apr_socket_t *client_socket = baton->client_soc;
-    apr_bucket_brigade *bb = baton->bb;
-
-    if (pfd->desc.s == sock) {
-        pollevent = pfd->rtnevents;
-        if (pollevent & (APR_POLLIN | APR_POLLHUP)) {
-            ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02446)
-                    "sock was readable");
-            return proxy_wstunnel_transfer(r, backconn, c, bb, "sock");
-        }
-        else if (pollevent & APR_POLLERR) {
-            ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(02447)
-                    "error on backconn");
-            return APR_EPIPE;
-        }
-        else { 
-            ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(02605)
-                    "unknown event on backconn %d", pollevent);
-            return APR_EGENERAL;
-        }
-    }
-    else if (pfd->desc.s == client_socket) {
-        pollevent = pfd->rtnevents;
-        if (pollevent & (APR_POLLIN | APR_POLLHUP)) {
-            ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02448)
-                    "client was readable");
-            return proxy_wstunnel_transfer(r, c, backconn, bb, "client");
-        }
-        else if (pollevent & APR_POLLERR) {
-            ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02607)
-                    "error on client conn");
-            c->aborted = 1;
-            return APR_EPIPE;
-        }
-        else { 
-            ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(02606)
-                    "unknown event on client conn %d", pollevent);
-            return APR_EGENERAL;
-        }
-    }
-    else {
-        ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(02449)
-                "unknown socket in pollset");
-        return APR_EBADF;
-    }
-}
-
-static int proxy_wstunnel_pump(ws_baton_t *baton, apr_time_t timeout, int try_async) {
-    request_rec *r = baton->r;
     const apr_pollfd_t *signalled;
     apr_int32_t pollcnt, pi;
+    apr_int16_t pollevent;
     apr_pollset_t *pollset = baton->pollset;
+    apr_socket_t *client_socket = baton->client_soc;
     apr_status_t rv;
+    apr_bucket_brigade *bb = baton->bb;
 
     while(1) { 
         if ((rv = apr_pollset_poll(pollset, timeout, &pollcnt, &signalled))
@@ -126,7 +79,51 @@ static int proxy_wstunnel_pump(ws_baton_
                 "woke from poll(), i=%d", pollcnt);
 
         for (pi = 0; pi < pollcnt; pi++) {
-            rv = proxy_wstunnel_pump2(baton, &signalled[pi]);
+            const apr_pollfd_t *cur = &signalled[pi];
+
+            if (cur->desc.s == sock) {
+                pollevent = cur->rtnevents;
+                if (pollevent & (APR_POLLIN | APR_POLLHUP)) {
+                    ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02446)
+                            "sock was readable");
+                    rv = proxy_wstunnel_transfer(r, backconn, c, bb, "sock");
+                }
+                else if (pollevent & APR_POLLERR) {
+                    rv = APR_EPIPE;
+                    ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(02447)
+                            "error on backconn");
+                }
+                else { 
+                    rv = APR_EGENERAL;
+                    ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(02605)
+                            "unknown event on backconn %d", pollevent);
+                }
+            }
+            else if (cur->desc.s == client_socket) {
+                pollevent = cur->rtnevents;
+                if (pollevent & (APR_POLLIN | APR_POLLHUP)) {
+                    ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02448)
+                            "client was readable");
+                    rv = proxy_wstunnel_transfer(r, c, backconn, bb, "client");
+                }
+                else if (pollevent & APR_POLLERR) {
+                    rv = APR_EPIPE;
+                    c->aborted = 1;
+                    ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02607)
+                            "error on client conn");
+                }
+                else { 
+                    rv = APR_EGENERAL;
+                    ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(02606)
+                            "unknown event on client conn %d", pollevent);
+                }
+            }
+            else {
+                rv = APR_EBADF;
+                ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(02449)
+                        "unknown socket in pollset");
+            }
+
         }
         if (rv != APR_SUCCESS) {
             break;
@@ -168,12 +165,14 @@ 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, const apr_pollfd_t *pfd) { 
+static void proxy_wstunnel_callback(void *b) { 
+    int status;
     apr_socket_t *sockets[3] = {NULL, NULL, NULL};
     ws_baton_t *baton = (ws_baton_t*)b;
     proxyws_dir_conf *dconf = ap_get_module_config(baton->r->per_dir_config, &proxy_wstunnel_module);
     apr_pool_clear(baton->subpool);
-    if (proxy_wstunnel_pump2(baton, pfd) == APR_SUCCESS) {
+    status = proxy_wstunnel_pump(baton, dconf->async_delay, dconf->is_async);
+    if (status == SUSPENDED) {
         sockets[0] = baton->client_soc;
         sockets[1] = baton->server_soc;
         ap_mpm_register_socket_callback_timeout(sockets, baton->subpool, 1, 

Modified: httpd/httpd/trunk/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1605946&r1=1605945&r2=1605946&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/event/event.c Fri Jun 27 04:17:30 2014
@@ -320,7 +320,7 @@ typedef struct
 
 typedef struct
 {
- ap_mpm_socket_callback_fn_t *cbfunc;
+ ap_mpm_callback_fn_t *cbfunc;
  void *user_baton; 
  apr_pollfd_t **pfds;
  int nsock;
@@ -1478,7 +1478,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_socket_callback_fn_t *cbfn,
+                                                  ap_mpm_callback_fn_t *cbfn,
                                                   ap_mpm_callback_fn_t *tofn,
                                                   void *baton, 
                                                   apr_time_t timeout)
@@ -1526,7 +1526,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_socket_callback_fn_t *cbfn,
+                                                  ap_mpm_callback_fn_t *cbfn,
                                                   void *baton)
 {
     return event_register_socket_callback_ex(s, p, for_read, 
@@ -1647,12 +1647,6 @@ 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)
 {
     apr_status_t rc;
@@ -1967,12 +1961,10 @@ static void * APR_THREAD_FUNC listener_t
 
                 /* We only signal once per N sockets with this baton */
                 if (!(baton->signaled)) { 
-                    apr_pollfd_t *newpfd = apr_palloc(out_pfd->p, sizeof(apr_pollfd_t));
                     baton->signaled = 1;
-                    *newpfd = *out_pfd;
                     te = event_get_timer_event(-1 /* fake timer */, 
-                                               socket_callback_wrapper, 
-                                               newpfd,
+                                               baton->cbfunc, 
+                                               baton->user_baton, 
                                                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=1605946&r1=1605945&r2=1605946&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_common.c (original)
+++ httpd/httpd/trunk/server/mpm_common.c Fri Jun 27 04:17:30 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_socket_callback_fn_t
*cbfn, void *baton),
+                            (apr_socket_t **s, apr_pool_t *p, int for_read, ap_mpm_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_socket_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_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_socket_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_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_socket_callback_fn_t
*cbfn, 
+                                                                 ap_mpm_callback_fn_t *cbfn,

                                                                  ap_mpm_callback_fn_t *tofn,

                                                                  void *baton, 
                                                                  apr_time_t timeout)



Mime
View raw message