#include <http_log.h>
#include <http_vhost.h>
+#include <ap_mpm.h>
+
#include <apr_strings.h>
#include "h2_alt_svc.h"
-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)
{
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);
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;
}
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__ */
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)) {
}
}
+ 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);
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;
* @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
* 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 */