Commit ec59ba4c authored by Walid Boudebouda's avatar Walid Boudebouda Committed by Dridi Boukelmoune

vtc_http: New struct h2_window

It groups the ws and iws fields together and hopefully conveys that
h2_window::init means "initial window size" slightly better than iws.
Signed-off-by: 's avatarDridi Boukelmoune <dridi.boukelmoune@gmail.com>
parent 9b42ca37
...@@ -42,6 +42,11 @@ struct vtc_sess { ...@@ -42,6 +42,11 @@ struct vtc_sess {
ssize_t rcvbuf; ssize_t rcvbuf;
}; };
struct h2_window {
uint64_t init;
int64_t size;
};
struct http { struct http {
unsigned magic; unsigned magic;
#define HTTP_MAGIC 0x2f02169c #define HTTP_MAGIC 0x2f02169c
...@@ -85,8 +90,7 @@ struct http { ...@@ -85,8 +90,7 @@ struct http {
pthread_cond_t cond; pthread_cond_t cond;
struct hpk_ctx *encctx; struct hpk_ctx *encctx;
struct hpk_ctx *decctx; struct hpk_ctx *decctx;
uint64_t iws; struct h2_window h2_win_self[1];
int64_t ws;
}; };
int http_process(struct vtclog *vl, struct vtc_sess *vsp, const char *spec, int http_process(struct vtclog *vl, struct vtc_sess *vsp, const char *spec,
......
...@@ -420,7 +420,7 @@ parse_data(struct stream *s, struct frame *f) ...@@ -420,7 +420,7 @@ parse_data(struct stream *s, struct frame *f)
if (s->id) if (s->id)
s->ws -= size; s->ws -= size;
s->hp->ws -= size; s->hp->h2_win_self->size -= size;
if (!size) { if (!size) {
AZ(data); AZ(data);
...@@ -1121,7 +1121,7 @@ cmd_var_resolve(const struct stream *s, const char *spec, char *buf) ...@@ -1121,7 +1121,7 @@ cmd_var_resolve(const struct stream *s, const char *spec, char *buf)
*/ */
if (!strcmp(spec, "stream.window")) { if (!strcmp(spec, "stream.window")) {
snprintf(buf, 20, "%jd", snprintf(buf, 20, "%jd",
(intmax_t)(s->id ? s->ws : s->hp->ws)); (intmax_t)(s->id ? s->ws : s->hp->h2_win_self->size));
return (buf); return (buf);
} }
if (!strcmp(spec, "stream.weight")) { if (!strcmp(spec, "stream.weight")) {
...@@ -1931,8 +1931,8 @@ cmd_txsettings(CMD_ARGS) ...@@ -1931,8 +1931,8 @@ cmd_txsettings(CMD_ARGS)
else if (!strcmp(*av, "-winsize")) { else if (!strcmp(*av, "-winsize")) {
PUT_KV(av, vl, winsize, val, 0x4); PUT_KV(av, vl, winsize, val, 0x4);
VTAILQ_FOREACH(_s, &hp->streams, list) VTAILQ_FOREACH(_s, &hp->streams, list)
_s->ws += (val - hp->iws); _s->ws += (val - hp->h2_win_self->init);
hp->iws = val; hp->h2_win_self->init = val;
} }
else if (!strcmp(*av, "-framesize")) else if (!strcmp(*av, "-framesize"))
PUT_KV(av, vl, framesize, val, 0x5); PUT_KV(av, vl, framesize, val, 0x5);
...@@ -2098,7 +2098,7 @@ cmd_txwinup(CMD_ARGS) ...@@ -2098,7 +2098,7 @@ cmd_txwinup(CMD_ARGS)
AZ(pthread_mutex_lock(&hp->mtx)); AZ(pthread_mutex_lock(&hp->mtx));
if (s->id == 0) if (s->id == 0)
hp->ws += size; hp->h2_win_self->size += size;
s->ws += size; s->ws += size;
AZ(pthread_mutex_unlock(&hp->mtx)); AZ(pthread_mutex_unlock(&hp->mtx));
...@@ -2593,7 +2593,7 @@ stream_new(const char *name, struct http *h) ...@@ -2593,7 +2593,7 @@ stream_new(const char *name, struct http *h)
REPLACE(s->name, name); REPLACE(s->name, name);
AN(s->name); AN(s->name);
VTAILQ_INIT(&s->fq); VTAILQ_INIT(&s->fq);
s->ws = h->iws; s->ws = h->h2_win_self->init;
s->vl = vtc_logopen("%s.%s", h->sess->name, name); s->vl = vtc_logopen("%s.%s", h->sess->name, name);
vtc_log_set_cmd(s->vl, stream_cmds); vtc_log_set_cmd(s->vl, stream_cmds);
...@@ -2840,8 +2840,8 @@ start_h2(struct http *hp) ...@@ -2840,8 +2840,8 @@ start_h2(struct http *hp)
AZ(pthread_mutex_init(&hp->mtx, NULL)); AZ(pthread_mutex_init(&hp->mtx, NULL));
AZ(pthread_cond_init(&hp->cond, NULL)); AZ(pthread_cond_init(&hp->cond, NULL));
VTAILQ_INIT(&hp->streams); VTAILQ_INIT(&hp->streams);
hp->iws = 0xffff; hp->h2_win_self->init = 0xffff;
hp->ws = 0xffff; hp->h2_win_self->size = 0xffff;
hp->h2 = 1; hp->h2 = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment