MEDIUM: stream: support a dynamic server timeout

Allow the modification of the timeout server value on the stream side.
Do not apply the default backend server timeout in back_establish if it
is already defined. This is the case if a set-timeout server rule has
been executed.
This commit is contained in:
Amaury Denoyelle 2020-12-10 13:43:52 +01:00 committed by Christopher Faulet
parent b715078821
commit 90d3d882e3

View File

@ -813,7 +813,15 @@ void stream_process_counters(struct stream *s)
int stream_set_timeout(struct stream *s, enum act_timeout_name name, int timeout)
{
return 0;
switch (name) {
case ACT_TIMEOUT_SERVER:
s->req.wto = timeout;
s->res.rto = timeout;
return 1;
default:
return 0;
}
}
/*
@ -884,9 +892,15 @@ static void back_establish(struct stream *s)
si_rx_endp_more(si);
rep->flags |= CF_READ_ATTACHED; /* producer is now attached */
if (objt_cs(si->end)) {
/* real connections have timeouts */
req->wto = s->be->timeout.server;
rep->rto = s->be->timeout.server;
/* real connections have timeouts
* if already defined, it means that a set-timeout rule has
* been executed so do not overwrite them
*/
if (!tick_isset(req->wto))
req->wto = s->be->timeout.server;
if (!tick_isset(rep->rto))
rep->rto = s->be->timeout.server;
/* The connection is now established, try to read data from the
* underlying layer, and subscribe to recv events. We use a
* delayed recv here to give a chance to the data to flow back