summaryrefslogtreecommitdiffstats
path: root/modules/http2/mod_proxy_http2.c
diff options
context:
space:
mode:
authorStefan Eissing <icing@apache.org>2016-02-25 14:14:30 +0100
committerStefan Eissing <icing@apache.org>2016-02-25 14:14:30 +0100
commit4dbe24518ace95b32eeef4fb508fcfa8c41403ae (patch)
treea206e856b0202b6093c403d5a1cc5c5dec1e2659 /modules/http2/mod_proxy_http2.c
parentupdate after backport (diff)
downloadapache2-4dbe24518ace95b32eeef4fb508fcfa8c41403ae.tar.xz
apache2-4dbe24518ace95b32eeef4fb508fcfa8c41403ae.zip
goodbye h2_stream_set, hello h2_ihash in h2_util
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1732295 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/http2/mod_proxy_http2.c')
-rw-r--r--modules/http2/mod_proxy_http2.c66
1 files changed, 40 insertions, 26 deletions
diff --git a/modules/http2/mod_proxy_http2.c b/modules/http2/mod_proxy_http2.c
index 3cdf44ae74..efd69465c2 100644
--- a/modules/http2/mod_proxy_http2.c
+++ b/modules/http2/mod_proxy_http2.c
@@ -233,11 +233,27 @@ static void request_done(h2_proxy_session *session, request_rec *r)
}
}
+static request_rec *next_request(h2_proxy_ctx *ctx, h2_proxy_session *session,
+ request_rec *r)
+{
+ if (!r && !ctx->standalone) {
+ ctx->engine->capacity = session->remote_max_concurrent;
+ if (req_engine_pull(ctx->engine, APR_NONBLOCK_READ, &r) == APR_SUCCESS) {
+ ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c,
+ "h2_proxy_session(%s): pulled request %s",
+ session->id, r->the_request);
+ }
+ }
+ return r;
+}
+
static apr_status_t proxy_engine_run(h2_proxy_ctx *ctx, request_rec *r) {
apr_status_t status = OK;
h2_proxy_session *session;
-setup_session:
+setup_backend:
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, ctx->owner,
+ "eng(%s): setup backend", ctx->engine->id);
/* Step Two: Make the Connection (or check that an already existing
* socket is still usable). On success, we have a socket connected to
* backend->hostname. */
@@ -280,6 +296,8 @@ setup_session:
/* Step Four: Send the Request in a new HTTP/2 stream and
* loop until we got the response or encounter errors.
*/
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, ctx->owner,
+ "eng(%s): setup session", ctx->engine->id);
session = h2_proxy_session_setup(ctx->engine->id, ctx->p_conn,
ctx->conf, request_done);
if (!session) {
@@ -289,39 +307,34 @@ setup_session:
}
run_session:
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, ctx->owner,
+ "eng(%s): run session %s", ctx->engine->id, session->id);
session->user_data = ctx;
- add_request(session, r);
- status = APR_EAGAIN;
+ status = h2_proxy_session_process(session);
while (APR_STATUS_IS_EAGAIN(status)) {
- status = h2_proxy_session_process(session);
-
- if (APR_STATUS_IS_EAGAIN(status) && !ctx->standalone) {
- ctx->engine->capacity = session->remote_max_concurrent;
- if (req_engine_pull(ctx->engine, APR_NONBLOCK_READ, &r) == APR_SUCCESS) {
- ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c,
- "h2_proxy_session(%s): pulled request %s",
- session->id, r->the_request);
- add_request(session, r);
- }
+ r = next_request(ctx, session, r);
+ if (r) {
+ add_request(session, r);
+ r = NULL;
}
+
+ status = h2_proxy_session_process(session);
}
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, ctx->owner,
+ "eng(%s): end of session run", ctx->engine->id);
if (session->state == H2_PROXYS_ST_DONE || status != APR_SUCCESS) {
ctx->p_conn->close = 1;
}
- if (!ctx->standalone) {
- ctx->engine->capacity = session->remote_max_concurrent;
- if (req_engine_pull(ctx->engine, APR_NONBLOCK_READ, &r) == APR_SUCCESS) {
- ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c,
- "h2_proxy_session(%s): idle, pulled request %s",
- session->id, r->the_request);
- add_request(session, r);
- if (ctx->p_conn->close) {
- goto setup_session;
- }
- goto run_session;
+ r = next_request(ctx, session, r);
+ if (r) {
+ if (ctx->p_conn->close) {
+ goto setup_backend;
}
+ add_request(session, r);
+ r = NULL;
+ goto run_session;
}
if (session->streams && !h2_iq_empty(session->streams)) {
@@ -330,8 +343,9 @@ run_session:
"session run done with %d streams unfinished",
h2_iq_size(session->streams));
}
- ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status,
- ctx->p_conn->connection, "session run done");
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status,
+ ctx->p_conn->connection, "eng(%s): session run done",
+ ctx->engine->id);
session->user_data = NULL;
return status;
}