You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2015/09/01 14:11:00 UTC

svn commit: r1700514 - in /httpd/httpd/trunk/modules/http2: h2_config.c h2_config.h h2_conn.c h2_version.h

Author: icing
Date: Tue Sep  1 12:11:00 2015
New Revision: 1700514

URL: http://svn.apache.org/r1700514
Log:
better connection state on ending sessions, improved default extra file config value depending on max workers per process

Modified:
    httpd/httpd/trunk/modules/http2/h2_config.c
    httpd/httpd/trunk/modules/http2/h2_config.h
    httpd/httpd/trunk/modules/http2/h2_conn.c
    httpd/httpd/trunk/modules/http2/h2_version.h

Modified: httpd/httpd/trunk/modules/http2/h2_config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_config.c?rev=1700514&r1=1700513&r2=1700514&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_config.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_config.c Tue Sep  1 12:11:00 2015
@@ -21,6 +21,8 @@
 #include <http_log.h>
 #include <http_vhost.h>
 
+#include <ap_mpm.h>
+
 #include <apr_strings.h>
 
 #include "h2_alt_svc.h"
@@ -46,9 +48,35 @@ static h2_config defconf = {
     -1,               /* alt-svc max age */
     0,                /* serialize headers */
     -1,               /* h2 direct mode */
-    5,                /* # session extra files */
+    -1,               /* # session extra files */
 };
 
+static int files_per_session = 0;
+
+void h2_config_init(apr_pool_t *pool) {
+    /* Determine a good default for this platform and mpm?
+     * TODO: not sure how APR wants to hand out this piece of 
+     * information.
+     */
+    int max_files = 256;
+    int conn_threads = 1;
+    int tx_files = max_files / 4;
+    
+    (void)pool;
+    ap_mpm_query(AP_MPMQ_MAX_THREADS, &conn_threads);
+    switch (h2_conn_mpm_type()) {
+        case H2_MPM_PREFORK:
+        case H2_MPM_WORKER:
+        case H2_MPM_EVENT:
+            /* allow that many transfer open files per mplx */
+            files_per_session = (tx_files / conn_threads);
+            break;
+        default:
+            /* don't know anything about it, stay safe */
+            break;
+    }
+}
+
 static void *h2_config_create(apr_pool_t *pool,
                               const char *prefix, const char *x)
 {
@@ -116,6 +144,7 @@ void *h2_config_merge(apr_pool_t *pool,
 
 int h2_config_geti(h2_config *conf, h2_config_var_t var)
 {
+    int n;
     switch(var) {
         case H2_CONF_MAX_STREAMS:
             return H2_CONFIG_GET(conf, &defconf, h2_max_streams);
@@ -136,7 +165,11 @@ int h2_config_geti(h2_config *conf, h2_c
         case H2_CONF_DIRECT:
             return H2_CONFIG_GET(conf, &defconf, h2_direct);
         case H2_CONF_SESSION_FILES:
-            return H2_CONFIG_GET(conf, &defconf, session_extra_files);
+            n = H2_CONFIG_GET(conf, &defconf, session_extra_files);
+            if (n < 0) {
+                n = files_per_session;
+            }
+            return n;
         default:
             return DEF_VAL;
     }

Modified: httpd/httpd/trunk/modules/http2/h2_config.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_config.h?rev=1700514&r1=1700513&r2=1700514&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_config.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_config.h Tue Sep  1 12:11:00 2015
@@ -68,5 +68,7 @@ h2_config *h2_config_rget(request_rec *r
 
 int h2_config_geti(h2_config *conf, h2_config_var_t var);
 
+void h2_config_init(apr_pool_t *pool);
+
 #endif /* __mod_h2__h2_config_h__ */
 

Modified: httpd/httpd/trunk/modules/http2/h2_conn.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_conn.c?rev=1700514&r1=1700513&r2=1700514&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_conn.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_conn.c Tue Sep  1 12:11:00 2015
@@ -84,19 +84,11 @@ apr_status_t h2_conn_child_init(apr_pool
     int idle_secs = 0;
     int i;
 
+    h2_config_init(pool);
+    
     ap_mpm_query(AP_MPMQ_MAX_THREADS, &max_threads_per_child);
     ap_mpm_query(AP_MPMQ_HARD_LIMIT_THREADS, &threads_limit);
     
-    if (minw <= 0) {
-        minw = max_threads_per_child;
-    }
-    if (maxw <= 0) {
-        maxw = threads_limit;
-        if (maxw < minw) {
-            maxw = minw;
-        }
-    }
-    
     for (i = 0; ap_loaded_modules[i]; ++i) {
         module *m = ap_loaded_modules[i];
         if (!strcmp("event.c", m->name)) {
@@ -116,6 +108,16 @@ apr_status_t h2_conn_child_init(apr_pool
         }
     }
     
+    if (minw <= 0) {
+        minw = max_threads_per_child;
+    }
+    if (maxw <= 0) {
+        maxw = threads_limit;
+        if (maxw < minw) {
+            maxw = minw;
+        }
+    }
+    
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
                  "h2_workers: min=%d max=%d, mthrpchild=%d, thr_limit=%d", 
                  minw, maxw, max_threads_per_child, threads_limit);
@@ -177,9 +179,10 @@ apr_status_t h2_conn_main(conn_rec *c)
     
     status = h2_session_process(session);
 
+    /* Make sure this connection gets closed properly. */
+    c->keepalive = AP_CONN_CLOSE;
     if (c->cs) {
-        /* Make sure this connection gets cleaned up properly. */
-        c->cs->state = CONN_STATE_LINGER;
+        c->cs->state = CONN_STATE_WRITE_COMPLETION;
     }
 
     return status;

Modified: httpd/httpd/trunk/modules/http2/h2_version.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_version.h?rev=1700514&r1=1700513&r2=1700514&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_version.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_version.h Tue Sep  1 12:11:00 2015
@@ -20,7 +20,7 @@
  * @macro
  * Version number of the h2 module as c string
  */
-#define MOD_H2_VERSION "0.9.2"
+#define MOD_H2_VERSION "0.9.6"
 
 /**
  * @macro
@@ -28,7 +28,7 @@
  * release. This is a 24 bit number with 8 bits for major number, 8 bits
  * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
  */
-#define MOD_H2_VERSION_NUM 0x000902
+#define MOD_H2_VERSION_NUM 0x000906
 
 
 #endif /* mod_h2_h2_version_h */