Hi,
spotted bu cppcheck.
Le 17/04/2017 à 11:17, ic...@apache.org a écrit :
Author: icing
Date: Mon Apr 17 09:17:55 2017
New Revision: 1791669
URL: http://svn.apache.org/viewvc?rev=1791669&view=rev
Log:
On the trunk:
mod_http2: MaxKeepAliveRequests now limits the number of times a
slave connection gets reused.
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/modules/http2/h2_mplx.c
httpd/httpd/trunk/modules/http2/h2_mplx.h
Modified: httpd/httpd/trunk/CHANGES
URL:
http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1791669&r1=1791668&r2=1791669&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Mon Apr 17 09:17:55 2017
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache 2.5.0
+ *) mod_http2: MaxKeepAliveRequests now limits the number of times a
+ slave connection gets reused. [Stefan Eissing]
+
*) mod_substitute: Fix spurious AH01328 (Line too long) errors on EBCDIC
systems. [Eric Covener]
Modified: httpd/httpd/trunk/modules/http2/h2_mplx.c
URL:
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_mplx.c?rev=1791669&r1=1791668&r2=1791669&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_mplx.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_mplx.c Mon Apr 17 09:17:55 2017
@@ -158,13 +158,18 @@ h2_mplx *h2_mplx_create(conn_rec *c, apr
apr_allocator_t *allocator;
apr_thread_mutex_t *mutex;
h2_mplx *m;
+ h2_ctx *ctx = h2_ctx_get(c, 0);
ap_assert(conf);
m = apr_pcalloc(parent, sizeof(h2_mplx));
if (m) {
m->id = c->id;
m->c = c;
-
+ m->s = (ctx? h2_ctx_server_get(ctx) : NULL);
+ if (!m->s) {
+ m->s = c->base_server;
+ }
+
/* We create a pool with its own allocator to be used for
* processing slave connections. This is the only way to have the
* processing independant of its parent pool in the sense that it
@@ -286,8 +291,11 @@ static void task_destroy(h2_mplx *m, h2_
int reuse_slave = 0;
slave = task->c;
- reuse_slave = ((m->spare_slaves->nelts < (m->limit_active * 3 / 2))
- && !task->rst_error);
+
+ if (m->s->keep_alive_max == 0 || slave->keepalives < m->s->keep_alive_max)
{
'cppcheck' spots that we deference 'slave' here, but...
+ reuse_slave = ((m->spare_slaves->nelts < (m->limit_active * 3 / 2))
+ && !task->rst_error);
+ }
if (slave) {
... test it for NULL here.
Either this test is needless, either the previous use of 'slave' is
spurioue.
if (reuse_slave && slave->keepalive == AP_CONN_KEEPALIVE) {
@@ -570,7 +578,10 @@ static apr_status_t out_close(h2_mplx *m
if (!task) {
return APR_ECONNABORTED;
}
-
+ if (task->c) {
+ ++task->c->keepalives;
+ }
+
stream = h2_ihash_get(m->streams, task->stream_id);
if (!stream) {
return APR_ECONNABORTED;
@@ -713,8 +724,7 @@ static h2_task *next_stream_task(h2_mplx
}
if (!stream->task) {
-
- m->c->keepalives++;
+
if (sid > m->max_stream_started) {
m->max_stream_started = sid;
}
Modified: httpd/httpd/trunk/modules/http2/h2_mplx.h
URL:
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_mplx.h?rev=1791669&r1=1791668&r2=1791669&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_mplx.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_mplx.h Mon Apr 17 09:17:55 2017
@@ -57,6 +57,7 @@ struct h2_mplx {
long id;
conn_rec *c;
apr_pool_t *pool;
+ server_rec *s; /* server for master conn */
unsigned int event_pending;
unsigned int aborted;