[master] f3862b4 Start keeping track of H2 state
Poul-Henning Kamp
phk at FreeBSD.org
Mon Sep 12 12:57:11 CEST 2016
commit f3862b4763ce27a08fbac6cd73a45f604aea9b3c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Sep 12 10:56:24 2016 +0000
Start keeping track of H2 state
diff --git a/bin/varnishd/http2/cache_http2.h b/bin/varnishd/http2/cache_http2.h
index 3bf1fdc..2fe1c23 100644
--- a/bin/varnishd/http2/cache_http2.h
+++ b/bin/varnishd/http2/cache_http2.h
@@ -32,17 +32,20 @@ struct h2_sess;
#include "hpack/vhp.h"
enum h2_error_e {
+ H2E__DUMMY = -1,
#define H2_ERROR(NAME, val, desc) \
H2E_##NAME = val,
#include "tbl/h2_error.h"
};
enum h2_frame_e {
+ H2_FRAME__DUMMY = -1,
#define H2_FRAME(l,u,t,f) H2_FRAME_##u = t,
#include "tbl/h2_frames.h"
};
enum h2_stream_e {
+ H2_STREAM__DUMMY = -1,
#define H2_STREAM(U,s,d) H2_S_##U,
#include "tbl/h2_stream.h"
};
@@ -51,6 +54,7 @@ enum h2_stream_e {
#include "tbl/h2_frames.h"
enum h2setting {
+ H2_SETTINGS__DUMMY = -1,
#define H2_SETTINGS(n,v,d) H2S_##n = v,
#include "tbl/h2_settings.h"
#undef H2_SETTINGS
diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index da64f9d..62b5079 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -188,6 +188,7 @@ h2_new_req(const struct worker *wrk, struct h2_sess *h2,
r2 = WS_Alloc(req->ws, sizeof *r2);
AN(r2);
INIT_OBJ(r2, H2_REQ_MAGIC);
+ r2->state = H2_S_IDLE;
r2->h2sess = h2;
r2->stream = stream;
r2->req = req;
@@ -384,6 +385,7 @@ h2_do_req(struct worker *wrk, void *priv)
assert(CNT_Request(wrk, req) != REQ_FSM_DISEMBARK);
VSL(SLT_Debug, 0, "H2REQ CNT done");
/* XXX clean up req */
+ r2->state = H2_S_CLOSED;
h2_del_req(wrk, r2, H2E_NO_ERROR);
}
@@ -400,7 +402,9 @@ h2_rx_headers(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
* read frames and proper error handling.
*/
- assert(h2->rxf_stream & 1);
+ xxxassert(h2->rxf_stream & 1);
+ xxxassert(r2->state == H2_S_IDLE);
+ r2->state = H2_S_OPEN;
req = r2->req;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
More information about the varnish-commit
mailing list