[master] ec59ba4c4 vtc_http: New struct h2_window
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Tue Jan 31 11:47:06 UTC 2023
commit ec59ba4c4f5ce4d9323aa1cbaaf97d5be00e00f6
Author: Walid Boudebouda <walid.boudebouda at gmail.com>
Date: Mon Dec 5 17:59:40 2022 +0100
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: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
diff --git a/bin/varnishtest/vtc_http.h b/bin/varnishtest/vtc_http.h
index c029cb80d..51028c1ef 100644
--- a/bin/varnishtest/vtc_http.h
+++ b/bin/varnishtest/vtc_http.h
@@ -42,6 +42,11 @@ struct vtc_sess {
ssize_t rcvbuf;
};
+struct h2_window {
+ uint64_t init;
+ int64_t size;
+};
+
struct http {
unsigned magic;
#define HTTP_MAGIC 0x2f02169c
@@ -85,8 +90,7 @@ struct http {
pthread_cond_t cond;
struct hpk_ctx *encctx;
struct hpk_ctx *decctx;
- uint64_t iws;
- int64_t ws;
+ struct h2_window h2_win_self[1];
};
int http_process(struct vtclog *vl, struct vtc_sess *vsp, const char *spec,
diff --git a/bin/varnishtest/vtc_http2.c b/bin/varnishtest/vtc_http2.c
index 7a848bb0d..990ffd291 100644
--- a/bin/varnishtest/vtc_http2.c
+++ b/bin/varnishtest/vtc_http2.c
@@ -420,7 +420,7 @@ parse_data(struct stream *s, struct frame *f)
if (s->id)
s->ws -= size;
- s->hp->ws -= size;
+ s->hp->h2_win_self->size -= size;
if (!size) {
AZ(data);
@@ -1121,7 +1121,7 @@ cmd_var_resolve(const struct stream *s, const char *spec, char *buf)
*/
if (!strcmp(spec, "stream.window")) {
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);
}
if (!strcmp(spec, "stream.weight")) {
@@ -1931,8 +1931,8 @@ cmd_txsettings(CMD_ARGS)
else if (!strcmp(*av, "-winsize")) {
PUT_KV(av, vl, winsize, val, 0x4);
VTAILQ_FOREACH(_s, &hp->streams, list)
- _s->ws += (val - hp->iws);
- hp->iws = val;
+ _s->ws += (val - hp->h2_win_self->init);
+ hp->h2_win_self->init = val;
}
else if (!strcmp(*av, "-framesize"))
PUT_KV(av, vl, framesize, val, 0x5);
@@ -2098,7 +2098,7 @@ cmd_txwinup(CMD_ARGS)
AZ(pthread_mutex_lock(&hp->mtx));
if (s->id == 0)
- hp->ws += size;
+ hp->h2_win_self->size += size;
s->ws += size;
AZ(pthread_mutex_unlock(&hp->mtx));
@@ -2593,7 +2593,7 @@ stream_new(const char *name, struct http *h)
REPLACE(s->name, name);
AN(s->name);
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);
vtc_log_set_cmd(s->vl, stream_cmds);
@@ -2840,8 +2840,8 @@ start_h2(struct http *hp)
AZ(pthread_mutex_init(&hp->mtx, NULL));
AZ(pthread_cond_init(&hp->cond, NULL));
VTAILQ_INIT(&hp->streams);
- hp->iws = 0xffff;
- hp->ws = 0xffff;
+ hp->h2_win_self->init = 0xffff;
+ hp->h2_win_self->size = 0xffff;
hp->h2 = 1;
More information about the varnish-commit
mailing list