mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 00:27:08 +02:00
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:
parent
b715078821
commit
90d3d882e3
16
src/stream.c
16
src/stream.c
@ -813,8 +813,16 @@ void stream_process_counters(struct stream *s)
|
|||||||
|
|
||||||
int stream_set_timeout(struct stream *s, enum act_timeout_name name, int timeout)
|
int stream_set_timeout(struct stream *s, enum act_timeout_name name, int timeout)
|
||||||
{
|
{
|
||||||
|
switch (name) {
|
||||||
|
case ACT_TIMEOUT_SERVER:
|
||||||
|
s->req.wto = timeout;
|
||||||
|
s->res.rto = timeout;
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function handles the transition between the SI_ST_CON state and the
|
* This function handles the transition between the SI_ST_CON state and the
|
||||||
@ -884,9 +892,15 @@ static void back_establish(struct stream *s)
|
|||||||
si_rx_endp_more(si);
|
si_rx_endp_more(si);
|
||||||
rep->flags |= CF_READ_ATTACHED; /* producer is now attached */
|
rep->flags |= CF_READ_ATTACHED; /* producer is now attached */
|
||||||
if (objt_cs(si->end)) {
|
if (objt_cs(si->end)) {
|
||||||
/* real connections have timeouts */
|
/* 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;
|
req->wto = s->be->timeout.server;
|
||||||
|
if (!tick_isset(rep->rto))
|
||||||
rep->rto = s->be->timeout.server;
|
rep->rto = s->be->timeout.server;
|
||||||
|
|
||||||
/* The connection is now established, try to read data from the
|
/* The connection is now established, try to read data from the
|
||||||
* underlying layer, and subscribe to recv events. We use a
|
* underlying layer, and subscribe to recv events. We use a
|
||||||
* delayed recv here to give a chance to the data to flow back
|
* delayed recv here to give a chance to the data to flow back
|
||||||
|
Loading…
Reference in New Issue
Block a user