mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-05-05 01:07:59 +00:00
MINOR: mux-quic: implement client-fin timeout
Implement client-fin timeout for MUX quic. This timeout is used once an applicative layer shutdown has been called. In HTTP/3, this corresponds to the emission of a GOAWAY. This should be backported up to 2.7.
This commit is contained in:
parent
14dbb848af
commit
eb7d320d25
@ -105,6 +105,7 @@ struct qcc {
|
|||||||
struct task *task;
|
struct task *task;
|
||||||
struct list opening_list; /* list of not already attached streams (http-request timeout) */
|
struct list opening_list; /* list of not already attached streams (http-request timeout) */
|
||||||
int timeout;
|
int timeout;
|
||||||
|
int shut_timeout;
|
||||||
int idle_start; /* base time for http-keep-alive timeout */
|
int idle_start; /* base time for http-keep-alive timeout */
|
||||||
|
|
||||||
const struct qcc_app_ops *app_ops;
|
const struct qcc_app_ops *app_ops;
|
||||||
|
@ -262,22 +262,22 @@ static void qcc_refresh_timeout(struct qcc *qcc)
|
|||||||
* it with global close_spread delay applied.
|
* it with global close_spread delay applied.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* TODO implement client/server-fin timeout for graceful shutdown */
|
|
||||||
|
|
||||||
/* Frontend timeout management
|
/* Frontend timeout management
|
||||||
|
* - shutdown done -> timeout client-fin
|
||||||
* - detached streams with data left to send -> default timeout
|
* - detached streams with data left to send -> default timeout
|
||||||
* - stream waiting on incomplete request or no stream yet activated -> timeout http-request
|
* - stream waiting on incomplete request or no stream yet activated -> timeout http-request
|
||||||
* - idle after stream processing -> timeout http-keep-alive
|
* - idle after stream processing -> timeout http-keep-alive
|
||||||
*/
|
*/
|
||||||
if (!conn_is_back(qcc->conn)) {
|
if (!conn_is_back(qcc->conn)) {
|
||||||
if (qcc->nb_hreq) {
|
if (qcc->nb_hreq && !(qcc->flags & QC_CF_APP_SHUT)) {
|
||||||
TRACE_DEVEL("one or more requests still in progress", QMUX_EV_QCC_WAKE, qcc->conn);
|
TRACE_DEVEL("one or more requests still in progress", QMUX_EV_QCC_WAKE, qcc->conn);
|
||||||
qcc->task->expire = tick_add_ifset(now_ms, qcc->timeout);
|
qcc->task->expire = tick_add_ifset(now_ms, qcc->timeout);
|
||||||
task_queue(qcc->task);
|
task_queue(qcc->task);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LIST_ISEMPTY(&qcc->opening_list) || unlikely(!qcc->largest_bidi_r)) {
|
if ((!LIST_ISEMPTY(&qcc->opening_list) || unlikely(!qcc->largest_bidi_r)) &&
|
||||||
|
!(qcc->flags & QC_CF_APP_SHUT)) {
|
||||||
int timeout = px->timeout.httpreq;
|
int timeout = px->timeout.httpreq;
|
||||||
struct qcs *qcs = NULL;
|
struct qcs *qcs = NULL;
|
||||||
int base_time;
|
int base_time;
|
||||||
@ -293,12 +293,18 @@ static void qcc_refresh_timeout(struct qcc *qcc)
|
|||||||
qcc->task->expire = tick_add_ifset(base_time, timeout);
|
qcc->task->expire = tick_add_ifset(base_time, timeout);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Use http-request timeout if keep-alive timeout not set */
|
if (qcc->flags & QC_CF_APP_SHUT) {
|
||||||
int timeout = tick_isset(px->timeout.httpka) ?
|
TRACE_DEVEL("connection in closing", QMUX_EV_QCC_WAKE, qcc->conn);
|
||||||
px->timeout.httpka : px->timeout.httpreq;
|
qcc->task->expire = tick_add_ifset(now_ms,
|
||||||
|
qcc->shut_timeout);
|
||||||
TRACE_DEVEL("at least one request achieved but none currently in progress", QMUX_EV_QCC_WAKE, qcc->conn);
|
}
|
||||||
qcc->task->expire = tick_add_ifset(qcc->idle_start, timeout);
|
else {
|
||||||
|
/* Use http-request timeout if keep-alive timeout not set */
|
||||||
|
int timeout = tick_isset(px->timeout.httpka) ?
|
||||||
|
px->timeout.httpka : px->timeout.httpreq;
|
||||||
|
TRACE_DEVEL("at least one request achieved but none currently in progress", QMUX_EV_QCC_WAKE, qcc->conn);
|
||||||
|
qcc->task->expire = tick_add_ifset(qcc->idle_start, timeout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2201,8 +2207,17 @@ static int qc_init(struct connection *conn, struct proxy *prx,
|
|||||||
qcc->proxy = prx;
|
qcc->proxy = prx;
|
||||||
/* haproxy timeouts */
|
/* haproxy timeouts */
|
||||||
qcc->task = NULL;
|
qcc->task = NULL;
|
||||||
qcc->timeout = conn_is_back(qcc->conn) ? prx->timeout.server :
|
if (conn_is_back(qcc->conn)) {
|
||||||
prx->timeout.client;
|
qcc->timeout = prx->timeout.server;
|
||||||
|
qcc->shut_timeout = tick_isset(prx->timeout.serverfin) ?
|
||||||
|
prx->timeout.serverfin : prx->timeout.server;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qcc->timeout = prx->timeout.client;
|
||||||
|
qcc->shut_timeout = tick_isset(prx->timeout.clientfin) ?
|
||||||
|
prx->timeout.clientfin : prx->timeout.client;
|
||||||
|
}
|
||||||
|
|
||||||
if (tick_isset(qcc->timeout)) {
|
if (tick_isset(qcc->timeout)) {
|
||||||
qcc->task = task_new_here();
|
qcc->task = task_new_here();
|
||||||
if (!qcc->task) {
|
if (!qcc->task) {
|
||||||
|
Loading…
Reference in New Issue
Block a user