mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-24 13:42:16 +00:00
MINOR: mux-h2: make sure any h2s always has an endpoint
The principle that each mux stream should have an endpoint is not guaranteed for closed streams that map to the dummy static streams. Let's have a dummy endpoint for use with such streams. It only has the DETACHED flag and a NULL conn_stream, and is referenced by all the closed streams so that we can afford not to test h2s->endp when trying to access the flags or the CS.
This commit is contained in:
parent
56d5a819d7
commit
b22b5f02af
10
src/mux_h2.c
10
src/mux_h2.c
@ -523,9 +523,16 @@ static int h2_settings_initial_window_size = 65535; /* initial value */
|
||||
static unsigned int h2_settings_max_concurrent_streams = 100;
|
||||
static int h2_settings_max_frame_size = 0; /* unset */
|
||||
|
||||
/* a dummy closed endpoint */
|
||||
static const struct cs_endpoint closed_ep = {
|
||||
. cs = NULL,
|
||||
.flags = CS_EP_DETACHED,
|
||||
};
|
||||
|
||||
/* a dmumy closed stream */
|
||||
static const struct h2s *h2_closed_stream = &(const struct h2s){
|
||||
.cs = NULL,
|
||||
.endp = (struct cs_endpoint *)&closed_ep,
|
||||
.h2c = NULL,
|
||||
.st = H2_SS_CLOSED,
|
||||
.errcode = H2_ERR_STREAM_CLOSED,
|
||||
@ -536,6 +543,7 @@ static const struct h2s *h2_closed_stream = &(const struct h2s){
|
||||
/* a dmumy closed stream returning a PROTOCOL_ERROR error */
|
||||
static const struct h2s *h2_error_stream = &(const struct h2s){
|
||||
.cs = NULL,
|
||||
.endp = (struct cs_endpoint *)&closed_ep,
|
||||
.h2c = NULL,
|
||||
.st = H2_SS_CLOSED,
|
||||
.errcode = H2_ERR_PROTOCOL_ERROR,
|
||||
@ -546,6 +554,7 @@ static const struct h2s *h2_error_stream = &(const struct h2s){
|
||||
/* a dmumy closed stream returning a REFUSED_STREAM error */
|
||||
static const struct h2s *h2_refused_stream = &(const struct h2s){
|
||||
.cs = NULL,
|
||||
.endp = (struct cs_endpoint *)&closed_ep,
|
||||
.h2c = NULL,
|
||||
.st = H2_SS_CLOSED,
|
||||
.errcode = H2_ERR_REFUSED_STREAM,
|
||||
@ -556,6 +565,7 @@ static const struct h2s *h2_refused_stream = &(const struct h2s){
|
||||
/* and a dummy idle stream for use with any unannounced stream */
|
||||
static const struct h2s *h2_idle_stream = &(const struct h2s){
|
||||
.cs = NULL,
|
||||
.endp = (struct cs_endpoint *)&closed_ep,
|
||||
.h2c = NULL,
|
||||
.st = H2_SS_IDLE,
|
||||
.errcode = H2_ERR_STREAM_CLOSED,
|
||||
|
Loading…
Reference in New Issue
Block a user