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
b167b52b
Commit
b167b52b
authored
Feb 17, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use table based dispatch for H2 rx
parent
7a834f42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
19 deletions
+27
-19
cache_http2_proto.c
bin/varnishd/http2/cache_http2_proto.c
+27
-19
No files found.
bin/varnishd/http2/cache_http2_proto.c
View file @
b167b52b
...
...
@@ -501,12 +501,25 @@ h2_frame_complete(struct http_conn *htc)
return
(
HTC_S_COMPLETE
);
}
struct
h2flist_s
{
const
char
*
name
;
h2_frame_f
*
func
;
uint8_t
flags
;
};
static
const
struct
h2flist_s
h2flist
[]
=
{
#define H2_FRAME(l,U,t,f) [t] = { #U, h2_rx_##l, f },
#include "tbl/h2_frames.h"
};
#define H2FMAX (sizeof(h2flist) / sizeof(h2flist[0]))
static
int
h2_rxframe
(
struct
worker
*
wrk
,
struct
h2_sess
*
h2
)
{
enum
htc_status_e
hs
;
enum
h2frame
ft
;
struct
h2_req
*
r2
=
NULL
;
const
struct
h2flist_s
*
h2f
;
(
void
)
VTCP_blocking
(
*
h2
->
htc
->
rfd
);
h2
->
sess
->
t_idle
=
VTIM_real
();
...
...
@@ -549,27 +562,22 @@ h2_rxframe(struct worker *wrk, struct h2_sess *h2)
r2
=
h2_new_req
(
wrk
,
h2
,
h2
->
rxf_stream
,
NULL
);
}
ft
=
(
enum
h2frame
)
h2
->
htc
->
rxbuf_b
[
3
];
switch
(
ft
)
{
#define H2_FRAME(l,u,t,f) \
case H2F_##u: \
if (!(h2->rxf_flags & ~f)) { \
(void)h2_rx_##l(wrk, h2, r2); \
} else { \
VSLb(h2->vsl, SLT_Debug, \
"H2: Bad flags 0x%02x on " #u, \
h2->rxf_flags); \
Lck_Unlock(&h2->sess->mtx); \
return (0); \
} \
break;
#include "tbl/h2_frames.h"
default
:
VSLb
(
h2
->
vsl
,
SLT_Debug
,
"H2: Bad frame type 0x%02x on "
,
h2
->
htc
->
rxbuf_b
[
3
]);
if
(
h2
->
htc
->
rxbuf_b
[
3
]
>=
H2FMAX
)
{
VSLb
(
h2
->
vsl
,
SLT_Debug
,
"H2: Unknown Frame %d"
,
h2
->
htc
->
rxbuf_b
[
3
]);
Lck_Unlock
(
&
h2
->
sess
->
mtx
);
return
(
0
);
}
h2f
=
h2flist
+
h2
->
htc
->
rxbuf_b
[
3
];
AN
(
h2f
->
name
);
if
(
h2
->
rxf_flags
&
~
h2f
->
flags
)
{
VSLb
(
h2
->
vsl
,
SLT_Debug
,
"H2: Bad flags 0x%02x on %s"
,
h2
->
rxf_flags
,
h2f
->
name
);
Lck_Unlock
(
&
h2
->
sess
->
mtx
);
return
(
0
);
}
(
void
)
h2f
->
func
(
wrk
,
h2
,
r2
);
Lck_Unlock
(
&
h2
->
sess
->
mtx
);
return
(
1
);
}
...
...
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