Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
75c344d2
Commit
75c344d2
authored
Jan 31, 2023
by
Walid Boudebouda
Committed by
Dridi Boukelmoune
Jan 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vtc_http2: Track the peer window of h2 streams
Signed-off-by:
Dridi Boukelmoune
<
dridi.boukelmoune@gmail.com
>
parent
f43c51b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
14 deletions
+55
-14
vtc_http.h
bin/varnishtest/vtc_http.h
+1
-0
vtc_http2.c
bin/varnishtest/vtc_http2.c
+54
-14
No files found.
bin/varnishtest/vtc_http.h
View file @
75c344d2
...
...
@@ -91,6 +91,7 @@ struct http {
struct
hpk_ctx
*
encctx
;
struct
hpk_ctx
*
decctx
;
struct
h2_window
h2_win_self
[
1
];
struct
h2_window
h2_win_peer
[
1
];
};
int
http_process
(
struct
vtclog
*
vl
,
struct
vtc_sess
*
vsp
,
const
char
*
spec
,
...
...
bin/varnishtest/vtc_http2.c
View file @
75c344d2
...
...
@@ -107,6 +107,7 @@ struct stream {
pthread_t
tp
;
struct
http
*
hp
;
int64_t
win_self
;
int64_t
win_peer
;
int
wf
;
VTAILQ_HEAD
(,
frame
)
fq
;
...
...
@@ -321,7 +322,7 @@ clean_frame(struct frame **fp)
}
static
void
write_frame
(
const
struct
stream
*
sp
,
const
struct
frame
*
f
,
const
unsigned
lock
)
write_frame
(
struct
stream
*
sp
,
const
struct
frame
*
f
,
const
unsigned
lock
)
{
struct
http
*
hp
;
ssize_t
l
;
...
...
@@ -340,6 +341,11 @@ write_frame(const struct stream *sp, const struct frame *f, const unsigned lock)
f
->
type
<
TYPE_MAX
?
h2_types
[
f
->
type
]
:
"?"
,
f
->
type
,
f
->
flags
,
f
->
size
);
if
(
f
->
type
==
TYPE_DATA
)
{
sp
->
win_peer
-=
f
->
size
;
hp
->
h2_win_peer
->
size
-=
f
->
size
;
}
if
(
lock
)
AZ
(
pthread_mutex_lock
(
&
hp
->
mtx
));
l
=
write
(
hp
->
sess
->
fd
,
hdr
,
sizeof
(
hdr
));
...
...
@@ -2398,6 +2404,50 @@ cmd_rxpush(CMD_ARGS)
s
->
frame
=
f
;
}
/* SECTION: stream.spec.winup_rxwinup rxwinup
*
* Receive a WINDOW_UPDATE frame.
*/
static
void
cmd_rxwinup
(
CMD_ARGS
)
{
struct
stream
*
s
;
struct
frame
*
f
;
CAST_OBJ_NOTNULL
(
s
,
priv
,
STREAM_MAGIC
);
s
->
frame
=
rxstuff
(
s
);
CAST_OBJ_NOTNULL
(
f
,
s
->
frame
,
FRAME_MAGIC
);
CHKFRAME
(
f
->
type
,
TYPE_WINDOW_UPDATE
,
0
,
*
av
);
if
(
s
->
id
==
0
)
s
->
hp
->
h2_win_peer
->
size
+=
s
->
frame
->
md
.
winup_size
;
s
->
win_peer
+=
s
->
frame
->
md
.
winup_size
;
}
/* SECTION: stream.spec.settings_rxsettings rxsettings
*
* Receive a SETTINGS frame.
*/
static
void
cmd_rxsettings
(
CMD_ARGS
)
{
struct
stream
*
s
,
*
_s
;
uint32_t
val
=
0
;
struct
http
*
hp
;
struct
frame
*
f
;
CAST_OBJ_NOTNULL
(
s
,
priv
,
STREAM_MAGIC
);
CAST_OBJ_NOTNULL
(
hp
,
s
->
hp
,
HTTP_MAGIC
);
s
->
frame
=
rxstuff
(
s
);
CAST_OBJ_NOTNULL
(
f
,
s
->
frame
,
FRAME_MAGIC
);
CHKFRAME
(
f
->
type
,
TYPE_SETTINGS
,
0
,
*
av
);
if
(
!
isnan
(
f
->
md
.
settings
[
SETTINGS_INITIAL_WINDOW_SIZE
]))
{
val
=
f
->
md
.
settings
[
SETTINGS_INITIAL_WINDOW_SIZE
];
VTAILQ_FOREACH
(
_s
,
&
hp
->
streams
,
list
)
_s
->
win_peer
+=
(
val
-
hp
->
h2_win_peer
->
init
);
hp
->
h2_win_peer
->
init
=
val
;
}
}
#define RXFUNC(lctype, upctype) \
static void \
cmd_rx ## lctype(CMD_ARGS) { \
...
...
@@ -2425,12 +2475,6 @@ RXFUNC(prio, PRIORITY)
*/
RXFUNC
(
rst
,
RST_STREAM
)
/* SECTION: stream.spec.settings_rxsettings rxsettings
*
* Receive a SETTINGS frame.
*/
RXFUNC
(
settings
,
SETTINGS
)
/* SECTION: stream.spec.ping_rxping rxping
*
* Receive a PING frame.
...
...
@@ -2443,12 +2487,6 @@ RXFUNC(ping, PING)
*/
RXFUNC
(
goaway
,
GOAWAY
)
/* SECTION: stream.spec.winup_rxwinup rxwinup
*
* Receive a WINDOW_UPDATE frame.
*/
RXFUNC
(
winup
,
WINDOW_UPDATE
)
/* SECTION: stream.spec.frame_rxframe
*
* Receive a frame, any frame.
...
...
@@ -2602,6 +2640,7 @@ stream_new(const char *name, struct http *h)
AN
(
s
->
name
);
VTAILQ_INIT
(
&
s
->
fq
);
s
->
win_self
=
h
->
h2_win_self
->
init
;
s
->
win_peer
=
h
->
h2_win_peer
->
init
;
s
->
vl
=
vtc_logopen
(
"%s.%s"
,
h
->
sess
->
name
,
name
);
vtc_log_set_cmd
(
s
->
vl
,
stream_cmds
);
...
...
@@ -2850,7 +2889,8 @@ start_h2(struct http *hp)
VTAILQ_INIT
(
&
hp
->
streams
);
hp
->
h2_win_self
->
init
=
0xffff
;
hp
->
h2_win_self
->
size
=
0xffff
;
hp
->
h2_win_peer
->
init
=
0xffff
;
hp
->
h2_win_peer
->
size
=
0xffff
;
hp
->
h2
=
1
;
hp
->
decctx
=
HPK_NewCtx
(
4096
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment