httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1565657 - in /httpd/httpd/trunk: include/ap_mmn.h include/http_core.h include/httpd.h server/connection.c server/core.c
Date Fri, 07 Feb 2014 13:54:39 GMT
Author: jim
Date: Fri Feb  7 13:54:38 2014
New Revision: 1565657

URL: http://svn.apache.org/r1565657
Log:
Add in the concept of "slave" connections...
Allows for several "connections" all resulting in
a single real connection that talks to the network.
Right now, nothing uses this though.

Modified:
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/include/http_core.h
    httpd/httpd/trunk/include/httpd.h
    httpd/httpd/trunk/server/connection.c
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1565657&r1=1565656&r2=1565657&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Fri Feb  7 13:54:38 2014
@@ -447,14 +447,15 @@
  * 20131230.0 (2.5.0-dev)  cl_head_zero & expect_strict added to server_config
  * 20131230.1 (2.5.0-dev)  REWRITE_REDIRECT_HANDLER_NAME in mod_rewrite.h
  * 20131230.2 (2.5.0-dev)  Prefix REWRITE_REDIRECT_HANDLER_NAME in mod_rewrite.h
+ * 20140207.0 (2.5.0-dev)  Support for slaved connections in core.c
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
 
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20131230
+#define MODULE_MAGIC_NUMBER_MAJOR 20140207
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 2                  /* 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/http_core.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_core.h?rev=1565657&r1=1565656&r2=1565657&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_core.h (original)
+++ httpd/httpd/trunk/include/http_core.h Fri Feb  7 13:54:38 2014
@@ -1036,6 +1036,15 @@ AP_DECLARE(int) ap_state_query(int query
   /** only dump some parts of the config */
 #define AP_SQ_RM_CONFIG_DUMP       4
 
+
+/* ---------------------------------------------------------------------- */
+
+/** Create a slave connection
+ * @param c The connection to create the slave connection from/for
+ * @return The slave connection
+ */
+AP_CORE_DECLARE(conn_rec *) ap_create_slave_connection(conn_rec *c);
+
 #ifdef __cplusplus
 }
 #endif

Modified: httpd/httpd/trunk/include/httpd.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/httpd.h?rev=1565657&r1=1565656&r2=1565657&view=diff
==============================================================================
--- httpd/httpd/trunk/include/httpd.h (original)
+++ httpd/httpd/trunk/include/httpd.h Fri Feb  7 13:54:38 2014
@@ -753,6 +753,8 @@ typedef struct process_rec process_rec;
 typedef struct server_rec server_rec;
 /** A structure that represents one connection */
 typedef struct conn_rec conn_rec;
+/** A structure that represents one slave connection */
+typedef struct conn_slave_rec conn_slave_rec;
 /** A structure that represents the current request */
 typedef struct request_rec request_rec;
 /** A structure that represents the status of the current connection */
@@ -1162,6 +1164,19 @@ struct conn_rec {
 #if APR_HAS_THREADS
     apr_thread_t *current_thread;
 #endif
+
+    /** Array of slave connections (conn_slave_rec *) for this connection. */
+    apr_array_header_t *slaves;
+
+    /** The "real" master connection. NULL if I am the master. */
+    conn_rec *master;
+
+    /** context of this connection */
+    void *ctx;
+};
+
+struct conn_slave_rec {
+  conn_rec *c;
 };
 
 /**

Modified: httpd/httpd/trunk/server/connection.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/connection.c?rev=1565657&r1=1565656&r2=1565657&view=diff
==============================================================================
--- httpd/httpd/trunk/server/connection.c (original)
+++ httpd/httpd/trunk/server/connection.c Fri Feb  7 13:54:38 2014
@@ -202,4 +202,3 @@ AP_CORE_DECLARE(void) ap_process_connect
         ap_run_process_connection(c);
     }
 }
-

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1565657&r1=1565656&r2=1565657&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Fri Feb  7 13:54:38 2014
@@ -4832,6 +4832,7 @@ static conn_rec *core_create_conn(apr_po
                                   apr_bucket_alloc_t *alloc)
 {
     apr_status_t rv;
+    apr_pool_t *pool;
     conn_rec *c = (conn_rec *) apr_pcalloc(ptrans, sizeof(conn_rec));
     core_server_config *sconf = ap_get_core_module_config(s->module_config);
 
@@ -4841,10 +4842,15 @@ static conn_rec *core_create_conn(apr_po
     /* Got a connection structure, so initialize what fields we can
      * (the rest are zeroed out by pcalloc).
      */
-    c->conn_config = ap_create_conn_config(ptrans);
-    c->notes = apr_table_make(ptrans, 5);
+    apr_pool_create(&pool, ptrans);
+    apr_pool_tag(pool, "master_conn");
+    c->pool = pool;
+
+    c->conn_config = ap_create_conn_config(c->pool);
+    c->notes = apr_table_make(c->pool, 5);
+    c->slaves = apr_array_make(c->pool, 20, sizeof(conn_rec *));
+
 
-    c->pool = ptrans;
     if ((rv = apr_socket_addr_get(&c->local_addr, APR_LOCAL, csd))
         != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_INFO, rv, s, APLOGNO(00137)
@@ -4931,11 +4937,35 @@ static int core_pre_connection(conn_rec 
     net->client_socket = csd;
 
     ap_set_core_module_config(net->c->conn_config, csd);
-    ap_add_input_filter_handle(ap_core_input_filter_handle, net, NULL, net->c);
-    ap_add_output_filter_handle(ap_core_output_filter_handle, net, NULL, net->c);
+    /* only the master connection talks to the network */
+    if (c->master == NULL) {
+        ap_add_input_filter_handle(ap_core_input_filter_handle, net, NULL,
+                                   net->c);
+        ap_add_output_filter_handle(ap_core_output_filter_handle, net, NULL,
+                                    net->c);
+    }
     return DONE;
 }
 
+AP_CORE_DECLARE(conn_rec *) ap_create_slave_connection(conn_rec *c)
+{
+    apr_pool_t *pool;
+    conn_slave_rec *new;
+    conn_rec *sc = (conn_rec *) apr_palloc(c->pool, sizeof(conn_rec));
+
+    apr_pool_create(&pool, c->pool);
+    apr_pool_tag(pool, "slave_conn");
+    memcpy(sc, c, sizeof(conn_rec));
+    sc->slaves = NULL;
+    sc->master = c;
+    sc->input_filters = NULL;
+    sc->output_filters = NULL;
+    sc->pool = pool;
+    new = apr_array_push(c->slaves);
+    new->c = sc;
+    return sc;
+}
+
 AP_DECLARE(int) ap_state_query(int query)
 {
     switch (query) {



Mime
View raw message