httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ic...@apache.org
Subject svn commit: r1729635 - in /httpd/httpd/trunk/modules/http2: h2_worker.c h2_worker.h
Date Wed, 10 Feb 2016 15:55:41 GMT
Author: icing
Date: Wed Feb 10 15:55:40 2016
New Revision: 1729635

URL: http://svn.apache.org/viewvc?rev=1729635&view=rev
Log:
using root pool for slave connections

Modified:
    httpd/httpd/trunk/modules/http2/h2_worker.c
    httpd/httpd/trunk/modules/http2/h2_worker.h

Modified: httpd/httpd/trunk/modules/http2/h2_worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_worker.c?rev=1729635&r1=1729634&r2=1729635&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_worker.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_worker.c Wed Feb 10 15:55:40 2016
@@ -35,8 +35,24 @@ static void* APR_THREAD_FUNC execute(apr
 {
     h2_worker *worker = (h2_worker *)wctx;
     apr_status_t status;
+    apr_allocator_t *task_allocator = NULL;
+    apr_pool_t *task_pool;
     
     (void)thread;
+    
+    /* We create a root pool with its own allocator to be used for
+     * processing a request. This is the only way to have the processing
+     * independant of the worker pool as the h2_mplx pool as well as
+     * not sensitive to which thread it is in.
+     * In that sense, memory allocation and lifetime is similar to a master
+     * connection.
+     * The mail goal in this is that slave connections and requests will
+     * - one day - be suspended and resumed in different threads.
+     */
+    apr_allocator_create(&task_allocator);
+    apr_pool_create_ex(&task_pool, NULL, NULL, task_allocator);
+    apr_allocator_owner_set(task_allocator, task_pool);
+
     /* Other code might want to see a socket for this connection this
      * worker processes. Allocate one without further function...
      */
@@ -62,7 +78,7 @@ static void* APR_THREAD_FUNC execute(apr
             conn_rec *c, *master = m->c;
             int stream_id = req->id;
             
-            c = h2_slave_create(master, worker->task_pool, 
+            c = h2_slave_create(master, task_pool, 
                                 worker->thread, worker->socket);
             if (!c) {
                 ap_log_cerror(APLOG_MARK, APLOG_WARNING, status, c,
@@ -73,7 +89,7 @@ static void* APR_THREAD_FUNC execute(apr
             else {
                 h2_task *task;
                 
-                task = h2_task_create(m->id, req, worker->task_pool, m);
+                task = h2_task_create(m->id, req, task_pool, m);
                 h2_ctx_create_for(c, task);
                 h2_task_do(task, c, worker->io, worker->socket);
                 task = NULL;
@@ -87,7 +103,7 @@ static void* APR_THREAD_FUNC execute(apr
              * long as it has requests to handle. Might no be fair to
              * other mplx's. Perhaps leave after n requests? */
             req = NULL;
-            apr_pool_clear(worker->task_pool);
+            apr_pool_clear(task_pool);
             h2_mplx_request_done(&m, stream_id, worker->aborted? NULL : &req);
         }
     }
@@ -134,7 +150,6 @@ h2_worker *h2_worker_create(int id,
             return NULL;
         }
         
-        apr_pool_create(&w->task_pool, w->pool);
         apr_thread_create(&w->thread, attr, execute, w, w->pool);
     }
     return w;
@@ -173,13 +188,4 @@ int h2_worker_is_aborted(h2_worker *work
     return worker->aborted;
 }
 
-h2_task *h2_worker_create_task(h2_worker *worker, h2_mplx *m, 
-                               const h2_request *req)
-{
-    h2_task *task;
-    
-    task = h2_task_create(m->id, req, worker->task_pool, m);
-    return task;
-}
-
 

Modified: httpd/httpd/trunk/modules/http2/h2_worker.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_worker.h?rev=1729635&r1=1729634&r2=1729635&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_worker.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_worker.h Wed Feb 10 15:55:40 2016
@@ -45,7 +45,6 @@ struct h2_worker {
     int id;
     apr_thread_t *thread;
     apr_pool_t *pool;
-    apr_pool_t *task_pool;
     struct apr_thread_cond_t *io;
     apr_socket_t *socket;
     
@@ -142,7 +141,4 @@ int h2_worker_get_id(h2_worker *worker);
 
 int h2_worker_is_aborted(h2_worker *worker);
 
-struct h2_task *h2_worker_create_task(h2_worker *worker, struct h2_mplx *m, 
-                                      const struct h2_request *req);
-                                      
 #endif /* defined(__mod_h2__h2_worker__) */



Mime
View raw message