]> granicus.if.org Git - apache/commitdiff
better connection state on ending sessions, improved default extra file config value...
authorStefan Eissing <icing@apache.org>
Tue, 1 Sep 2015 12:11:00 +0000 (12:11 +0000)
committerStefan Eissing <icing@apache.org>
Tue, 1 Sep 2015 12:11:00 +0000 (12:11 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1700514 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_config.c
modules/http2/h2_config.h
modules/http2/h2_conn.c
modules/http2/h2_version.h

index 410522e73fb202bdeffddb189b10886e39884d89..470f8c0fe4cf8bf6fbb99c192d7c07e3cecae252 100644 (file)
@@ -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, void *basev, void *addv)
 
 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_config_var_t var)
         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;
     }
index a13a590514034a3381861978690f176822816ebe..931af59d302145819c7fe463ae760dad282b56ae 100644 (file)
@@ -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__ */
 
index 60c76b323b51a115a5de01f8fb2f1db3fe8f0627..38e5c11a2836e6e9c3954edea704aa396cda6986 100644 (file)
@@ -84,19 +84,11 @@ apr_status_t h2_conn_child_init(apr_pool_t *pool, server_rec *s)
     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_t *pool, server_rec *s)
         }
     }
     
+    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;
index b253bef68ad2cc7e5ca8f1ca4482677e79a683c8..abd90d80923e269e490db69b8f0e511b5d5d708e 100644 (file)
@@ -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 */