mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
MINOR: mux-h2: learn and store the peer's advertised MAX_CONCURRENT_STREAMS setting
We used not to take it into account because we only used the configured parameter everywhere. This patch makes sure we can actually learn the value advertised by the peer. We still enforce our own limit on top of it however, to make sure we can actually limit resources or stream concurrency in case of suboptimal server settings.
This commit is contained in:
parent
fa1d357f05
commit
2e2083ae5b
10
src/mux_h2.c
10
src/mux_h2.c
@ -87,6 +87,7 @@ struct h2c {
|
|||||||
|
|
||||||
/* 16 bit hole here */
|
/* 16 bit hole here */
|
||||||
uint32_t flags; /* connection flags: H2_CF_* */
|
uint32_t flags; /* connection flags: H2_CF_* */
|
||||||
|
uint32_t streams_limit; /* maximum number of concurrent streams the peer supports */
|
||||||
int32_t max_id; /* highest ID known on this connection, <0 before preface */
|
int32_t max_id; /* highest ID known on this connection, <0 before preface */
|
||||||
uint32_t rcvd_c; /* newly received data to ACK for the connection */
|
uint32_t rcvd_c; /* newly received data to ACK for the connection */
|
||||||
uint32_t rcvd_s; /* newly received data to ACK for the current stream (dsi) */
|
uint32_t rcvd_s; /* newly received data to ACK for the current stream (dsi) */
|
||||||
@ -503,6 +504,7 @@ static int h2_init(struct connection *conn, struct proxy *prx, struct session *s
|
|||||||
/* Initialise the context. */
|
/* Initialise the context. */
|
||||||
h2c->st0 = H2_CS_PREFACE;
|
h2c->st0 = H2_CS_PREFACE;
|
||||||
h2c->conn = conn;
|
h2c->conn = conn;
|
||||||
|
h2c->streams_limit = h2_settings_max_concurrent_streams;
|
||||||
h2c->max_id = -1;
|
h2c->max_id = -1;
|
||||||
h2c->errcode = H2_ERR_NO_ERROR;
|
h2c->errcode = H2_ERR_NO_ERROR;
|
||||||
h2c->rcvd_c = 0;
|
h2c->rcvd_c = 0;
|
||||||
@ -1495,6 +1497,14 @@ static int h2c_handle_settings(struct h2c *h2c)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case H2_SETTINGS_MAX_CONCURRENT_STREAMS:
|
||||||
|
if (h2c->flags & H2_CF_IS_BACK) {
|
||||||
|
/* the limit is only for the backend; for the frontend it is our limit */
|
||||||
|
if ((unsigned int)arg > h2_settings_max_concurrent_streams)
|
||||||
|
arg = h2_settings_max_concurrent_streams;
|
||||||
|
h2c->streams_limit = arg;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user