[CLEANUP] grouped all timeouts in one structure
All known timeouts in a proxy have been grouped into a "timeout" sub-structure.
This commit is contained in:
parent
e219db7a46
commit
d7c30f9a8c
@ -169,13 +169,13 @@ struct proxy {
|
||||
char *monitor_uri; /* a special URI to which we respond with HTTP/200 OK */
|
||||
int monitor_uri_len; /* length of the string above. 0 if unused */
|
||||
struct list mon_fail_cond; /* list of conditions to fail monitoring requests (chained) */
|
||||
struct timeval clitimeout; /* client I/O timeout (in milliseconds) */
|
||||
struct timeval srvtimeout; /* server I/O timeout (in milliseconds) */
|
||||
struct timeval contimeout; /* connect timeout (in milliseconds) */
|
||||
struct timeval appsession_timeout;
|
||||
struct {
|
||||
struct timeval queue; /* queue timeout, defaults to contimeout if unspecified */
|
||||
struct timeval tarpit; /* tarpit timeout, defaults to contimeout if unspecified */
|
||||
struct timeval client; /* client I/O timeout (in milliseconds) */
|
||||
struct timeval tarpit; /* tarpit timeout, defaults to connect if unspecified */
|
||||
struct timeval queue; /* queue timeout, defaults to connect if unspecified */
|
||||
struct timeval connect; /* connect timeout (in milliseconds) */
|
||||
struct timeval server; /* server I/O timeout (in milliseconds) */
|
||||
struct timeval appsession;
|
||||
} timeout;
|
||||
char *id; /* proxy id */
|
||||
struct list pendconns; /* pending connections with no server assigned yet */
|
||||
|
@ -1329,7 +1329,7 @@ int connect_server(struct session *s)
|
||||
s->srv->cur_sess_max = s->srv->cur_sess;
|
||||
}
|
||||
|
||||
if (!tv_add_ifset(&s->req->cex, &now, &s->be->contimeout))
|
||||
if (!tv_add_ifset(&s->req->cex, &now, &s->be->timeout.connect))
|
||||
tv_eternity(&s->req->cex);
|
||||
return SN_ERR_NONE; /* connection is OK */
|
||||
}
|
||||
|
@ -498,10 +498,10 @@ static void init_default_instance()
|
||||
defproxy.maxconn = cfg_maxpconn;
|
||||
defproxy.conn_retries = CONN_RETRIES;
|
||||
defproxy.logfac1 = defproxy.logfac2 = -1; /* log disabled */
|
||||
tv_eternity(&defproxy.clitimeout);
|
||||
tv_eternity(&defproxy.contimeout);
|
||||
tv_eternity(&defproxy.srvtimeout);
|
||||
tv_eternity(&defproxy.appsession_timeout);
|
||||
tv_eternity(&defproxy.timeout.client);
|
||||
tv_eternity(&defproxy.timeout.connect);
|
||||
tv_eternity(&defproxy.timeout.server);
|
||||
tv_eternity(&defproxy.timeout.appsession);
|
||||
tv_eternity(&defproxy.timeout.queue);
|
||||
tv_eternity(&defproxy.timeout.tarpit);
|
||||
}
|
||||
@ -580,10 +580,10 @@ int cfg_parse_listen(const char *file, int linenum, char **args)
|
||||
/* Timeouts are defined as -1, so we cannot use the zeroed area
|
||||
* as a default value.
|
||||
*/
|
||||
tv_eternity(&curproxy->clitimeout);
|
||||
tv_eternity(&curproxy->srvtimeout);
|
||||
tv_eternity(&curproxy->contimeout);
|
||||
tv_eternity(&curproxy->appsession_timeout);
|
||||
tv_eternity(&curproxy->timeout.client);
|
||||
tv_eternity(&curproxy->timeout.server);
|
||||
tv_eternity(&curproxy->timeout.connect);
|
||||
tv_eternity(&curproxy->timeout.appsession);
|
||||
tv_eternity(&curproxy->timeout.queue);
|
||||
tv_eternity(&curproxy->timeout.tarpit);
|
||||
|
||||
@ -643,7 +643,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args)
|
||||
}
|
||||
|
||||
if (curproxy->cap & PR_CAP_FE) {
|
||||
curproxy->clitimeout = defproxy.clitimeout;
|
||||
curproxy->timeout.client = defproxy.timeout.client;
|
||||
curproxy->timeout.tarpit = defproxy.timeout.tarpit;
|
||||
curproxy->uri_auth = defproxy.uri_auth;
|
||||
curproxy->mon_net = defproxy.mon_net;
|
||||
@ -656,8 +656,8 @@ int cfg_parse_listen(const char *file, int linenum, char **args)
|
||||
}
|
||||
|
||||
if (curproxy->cap & PR_CAP_BE) {
|
||||
curproxy->contimeout = defproxy.contimeout;
|
||||
curproxy->srvtimeout = defproxy.srvtimeout;
|
||||
curproxy->timeout.connect = defproxy.timeout.connect;
|
||||
curproxy->timeout.server = defproxy.timeout.server;
|
||||
curproxy->timeout.queue = defproxy.timeout.queue;
|
||||
curproxy->source_addr = defproxy.source_addr;
|
||||
}
|
||||
@ -882,9 +882,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args)
|
||||
return -1;
|
||||
}
|
||||
if (val > 0)
|
||||
__tv_from_ms(&curproxy->appsession_timeout, val);
|
||||
__tv_from_ms(&curproxy->timeout.appsession, val);
|
||||
else
|
||||
tv_eternity(&curproxy->appsession_timeout);
|
||||
tv_eternity(&curproxy->timeout.appsession);
|
||||
|
||||
if (appsession_hash_init(&(curproxy->htbl_proxy), destroy) == 0) {
|
||||
Alert("parsing [%s:%d] : out of memory.\n", file, linenum);
|
||||
@ -2682,9 +2682,9 @@ int readcfgfile(const char *file)
|
||||
}
|
||||
|
||||
if ((curproxy->mode == PR_MODE_TCP || curproxy->mode == PR_MODE_HTTP) &&
|
||||
(((curproxy->cap & PR_CAP_FE) && !tv_isset(&curproxy->clitimeout)) ||
|
||||
(((curproxy->cap & PR_CAP_FE) && !tv_isset(&curproxy->timeout.client)) ||
|
||||
((curproxy->cap & PR_CAP_BE) && (curproxy->srv) &&
|
||||
(!tv_isset(&curproxy->contimeout) || !tv_isset(&curproxy->srvtimeout))))) {
|
||||
(!tv_isset(&curproxy->timeout.connect) || !tv_isset(&curproxy->timeout.server))))) {
|
||||
Warning("parsing %s : missing timeouts for %s '%s'.\n"
|
||||
" | While not properly invalid, you will certainly encounter various problems\n"
|
||||
" | with such a configuration. To fix this, please ensure that all following\n"
|
||||
@ -2705,10 +2705,10 @@ int readcfgfile(const char *file)
|
||||
*/
|
||||
if (tv_isset(&defproxy.timeout.tarpit))
|
||||
curproxy->timeout.tarpit = defproxy.timeout.tarpit;
|
||||
else if (tv_isset(&curproxy->contimeout))
|
||||
curproxy->timeout.tarpit = curproxy->contimeout;
|
||||
else if (tv_isset(&defproxy.contimeout))
|
||||
curproxy->timeout.tarpit = defproxy.contimeout;
|
||||
else if (tv_isset(&curproxy->timeout.connect))
|
||||
curproxy->timeout.tarpit = curproxy->timeout.connect;
|
||||
else if (tv_isset(&defproxy.timeout.connect))
|
||||
curproxy->timeout.tarpit = defproxy.timeout.connect;
|
||||
}
|
||||
if ((curproxy->cap & PR_CAP_BE) &&
|
||||
(!tv_isset(&curproxy->timeout.queue) ||
|
||||
@ -2718,10 +2718,10 @@ int readcfgfile(const char *file)
|
||||
*/
|
||||
if (tv_isset(&defproxy.timeout.queue))
|
||||
curproxy->timeout.queue = defproxy.timeout.queue;
|
||||
else if (tv_isset(&curproxy->contimeout))
|
||||
curproxy->timeout.queue = curproxy->contimeout;
|
||||
else if (tv_isset(&defproxy.contimeout))
|
||||
curproxy->timeout.queue = defproxy.contimeout;
|
||||
else if (tv_isset(&curproxy->timeout.connect))
|
||||
curproxy->timeout.queue = curproxy->timeout.connect;
|
||||
else if (tv_isset(&defproxy.timeout.connect))
|
||||
curproxy->timeout.queue = defproxy.timeout.connect;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2826,7 +2826,7 @@ int readcfgfile(const char *file)
|
||||
if (curproxy->options & PR_O_TCP_NOLING)
|
||||
listener->options |= LI_O_NOLINGER;
|
||||
listener->maxconn = curproxy->maxconn;
|
||||
listener->timeout = &curproxy->clitimeout;
|
||||
listener->timeout = &curproxy->timeout.client;
|
||||
listener->accept = event_accept;
|
||||
listener->private = curproxy;
|
||||
|
||||
|
16
src/client.c
16
src/client.c
@ -348,17 +348,17 @@ int event_accept(int fd) {
|
||||
if (s->cli_state == CL_STHEADERS) /* reserve some space for header rewriting */
|
||||
s->req->rlim -= MAXREWRITE;
|
||||
|
||||
s->req->rto = s->fe->clitimeout;
|
||||
s->req->wto = s->be->srvtimeout;
|
||||
s->req->cto = s->be->contimeout;
|
||||
s->req->rto = s->fe->timeout.client;
|
||||
s->req->wto = s->be->timeout.server;
|
||||
s->req->cto = s->be->timeout.connect;
|
||||
|
||||
if ((s->rep = pool_alloc2(pool2_buffer)) == NULL)
|
||||
goto out_fail_rep; /* no memory */
|
||||
|
||||
buffer_init(s->rep);
|
||||
|
||||
s->rep->rto = s->be->srvtimeout;
|
||||
s->rep->wto = s->fe->clitimeout;
|
||||
s->rep->rto = s->be->timeout.server;
|
||||
s->rep->wto = s->fe->timeout.client;
|
||||
tv_eternity(&s->rep->cto);
|
||||
|
||||
fd_insert(cfd);
|
||||
@ -397,13 +397,13 @@ int event_accept(int fd) {
|
||||
tv_eternity(&s->rep->wex);
|
||||
tv_eternity(&t->expire);
|
||||
|
||||
if (tv_isset(&s->fe->clitimeout)) {
|
||||
if (tv_isset(&s->fe->timeout.client)) {
|
||||
if (EV_FD_ISSET(cfd, DIR_RD)) {
|
||||
tv_add(&s->req->rex, &now, &s->fe->clitimeout);
|
||||
tv_add(&s->req->rex, &now, &s->fe->timeout.client);
|
||||
t->expire = s->req->rex;
|
||||
}
|
||||
if (EV_FD_ISSET(cfd, DIR_WR)) {
|
||||
tv_add(&s->rep->wex, &now, &s->fe->clitimeout);
|
||||
tv_add(&s->rep->wex, &now, &s->fe->timeout.client);
|
||||
t->expire = s->rep->wex;
|
||||
}
|
||||
}
|
||||
|
@ -1603,7 +1603,7 @@ int process_cli(struct session *t)
|
||||
* full. We cannot loop here since stream_sock_read will disable it only if
|
||||
* req->l == rlim-data
|
||||
*/
|
||||
if (!tv_add_ifset(&req->rex, &now, &t->fe->clitimeout))
|
||||
if (!tv_add_ifset(&req->rex, &now, &t->fe->timeout.client))
|
||||
tv_eternity(&req->rex);
|
||||
}
|
||||
return t->cli_state != CL_STHEADERS;
|
||||
@ -1879,8 +1879,8 @@ int process_cli(struct session *t)
|
||||
t->be->cum_beconn++;
|
||||
|
||||
/* assign new parameters to the session from the new backend */
|
||||
t->rep->rto = t->req->wto = t->be->srvtimeout;
|
||||
t->req->cto = t->be->contimeout;
|
||||
t->rep->rto = t->req->wto = t->be->timeout.server;
|
||||
t->req->cto = t->be->timeout.connect;
|
||||
t->conn_retries = t->be->conn_retries;
|
||||
t->flags |= SN_BE_ASSIGNED;
|
||||
break;
|
||||
@ -1900,8 +1900,8 @@ int process_cli(struct session *t)
|
||||
t->be->cum_beconn++;
|
||||
|
||||
/* assign new parameters to the session from the new backend */
|
||||
t->rep->rto = t->req->wto = t->be->srvtimeout;
|
||||
t->req->cto = t->be->contimeout;
|
||||
t->rep->rto = t->req->wto = t->be->timeout.server;
|
||||
t->req->cto = t->be->timeout.connect;
|
||||
t->conn_retries = t->be->conn_retries;
|
||||
t->flags |= SN_BE_ASSIGNED;
|
||||
}
|
||||
@ -2024,8 +2024,8 @@ int process_cli(struct session *t)
|
||||
|
||||
t->logs.t_request = tv_ms_elapsed(&t->logs.tv_accept, &now);
|
||||
|
||||
if (!tv_isset(&t->fe->clitimeout) ||
|
||||
(t->srv_state < SV_STDATA && tv_isset(&t->be->srvtimeout))) {
|
||||
if (!tv_isset(&t->fe->timeout.client) ||
|
||||
(t->srv_state < SV_STDATA && tv_isset(&t->be->timeout.server))) {
|
||||
/* If the client has no timeout, or if the server is not ready yet,
|
||||
* and we know for sure that it can expire, then it's cleaner to
|
||||
* disable the timeout on the client side so that too low values
|
||||
@ -2108,7 +2108,7 @@ int process_cli(struct session *t)
|
||||
/* We must ensure that the read part is still alive when switching
|
||||
* to shutw */
|
||||
EV_FD_SET(t->cli_fd, DIR_RD);
|
||||
tv_add_ifset(&req->rex, &now, &t->fe->clitimeout);
|
||||
tv_add_ifset(&req->rex, &now, &t->fe->timeout.client);
|
||||
t->cli_state = CL_STSHUTW;
|
||||
//fprintf(stderr,"%p:%s(%d), c=%d, s=%d\n", t, __FUNCTION__, __LINE__, t->cli_state, t->cli_state);
|
||||
return 1;
|
||||
@ -2138,7 +2138,7 @@ int process_cli(struct session *t)
|
||||
/* We must ensure that the read part is still alive when switching
|
||||
* to shutw */
|
||||
EV_FD_SET(t->cli_fd, DIR_RD);
|
||||
tv_add_ifset(&req->rex, &now, &t->fe->clitimeout);
|
||||
tv_add_ifset(&req->rex, &now, &t->fe->timeout.client);
|
||||
|
||||
t->cli_state = CL_STSHUTW;
|
||||
if (!(t->flags & SN_ERR_MASK))
|
||||
@ -2163,8 +2163,8 @@ int process_cli(struct session *t)
|
||||
} else {
|
||||
/* there's still some space in the buffer */
|
||||
if (EV_FD_COND_S(t->cli_fd, DIR_RD)) {
|
||||
if (!tv_isset(&t->fe->clitimeout) ||
|
||||
(t->srv_state < SV_STDATA && tv_isset(&t->be->srvtimeout)))
|
||||
if (!tv_isset(&t->fe->timeout.client) ||
|
||||
(t->srv_state < SV_STDATA && tv_isset(&t->be->timeout.server)))
|
||||
/* If the client has no timeout, or if the server not ready yet, and we
|
||||
* know for sure that it can expire, then it's cleaner to disable the
|
||||
* timeout on the client side so that too low values cannot make the
|
||||
@ -2172,7 +2172,7 @@ int process_cli(struct session *t)
|
||||
*/
|
||||
tv_eternity(&req->rex);
|
||||
else
|
||||
tv_add(&req->rex, &now, &t->fe->clitimeout);
|
||||
tv_add(&req->rex, &now, &t->fe->timeout.client);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2186,7 +2186,7 @@ int process_cli(struct session *t)
|
||||
/* buffer not empty */
|
||||
if (EV_FD_COND_S(t->cli_fd, DIR_WR)) {
|
||||
/* restart writing */
|
||||
if (tv_add_ifset(&rep->wex, &now, &t->fe->clitimeout)) {
|
||||
if (tv_add_ifset(&rep->wex, &now, &t->fe->timeout.client)) {
|
||||
/* FIXME: to prevent the client from expiring read timeouts during writes,
|
||||
* we refresh it. */
|
||||
req->rex = rep->wex;
|
||||
@ -2258,7 +2258,7 @@ int process_cli(struct session *t)
|
||||
/* buffer not empty */
|
||||
if (EV_FD_COND_S(t->cli_fd, DIR_WR)) {
|
||||
/* restart writing */
|
||||
if (!tv_add_ifset(&rep->wex, &now, &t->fe->clitimeout))
|
||||
if (!tv_add_ifset(&rep->wex, &now, &t->fe->timeout.client))
|
||||
tv_eternity(&rep->wex);
|
||||
}
|
||||
}
|
||||
@ -2318,7 +2318,7 @@ int process_cli(struct session *t)
|
||||
} else {
|
||||
/* there's still some space in the buffer */
|
||||
if (EV_FD_COND_S(t->cli_fd, DIR_RD)) {
|
||||
if (!tv_add_ifset(&req->rex, &now, &t->fe->clitimeout))
|
||||
if (!tv_add_ifset(&req->rex, &now, &t->fe->timeout.client))
|
||||
tv_eternity(&req->rex);
|
||||
//fprintf(stderr,"%p:%s(%d), c=%d, s=%d\n", t, __FUNCTION__, __LINE__, t->cli_state, t->cli_state);
|
||||
}
|
||||
@ -2357,14 +2357,14 @@ int process_srv(struct session *t)
|
||||
#if 0
|
||||
fprintf(stderr,"%s:%d fe->clito=%d.%d, fe->conto=%d.%d, fe->srvto=%d.%d\n",
|
||||
__FUNCTION__, __LINE__,
|
||||
t->fe->clitimeout.tv_sec, t->fe->clitimeout.tv_usec,
|
||||
t->fe->contimeout.tv_sec, t->fe->contimeout.tv_usec,
|
||||
t->fe->srvtimeout.tv_sec, t->fe->srvtimeout.tv_usec);
|
||||
t->fe->timeout.client.tv_sec, t->fe->timeout.client.tv_usec,
|
||||
t->fe->timeout.connect.tv_sec, t->fe->timeout.connect.tv_usec,
|
||||
t->fe->timeout.server.tv_sec, t->fe->timeout.server.tv_usec);
|
||||
fprintf(stderr,"%s:%d be->clito=%d.%d, be->conto=%d.%d, be->srvto=%d.%d\n",
|
||||
__FUNCTION__, __LINE__,
|
||||
t->be->clitimeout.tv_sec, t->be->clitimeout.tv_usec,
|
||||
t->be->contimeout.tv_sec, t->be->contimeout.tv_usec,
|
||||
t->be->srvtimeout.tv_sec, t->be->srvtimeout.tv_usec);
|
||||
t->be->timeout.client.tv_sec, t->be->timeout.client.tv_usec,
|
||||
t->be->timeout.connect.tv_sec, t->be->timeout.connect.tv_usec,
|
||||
t->be->timeout.server.tv_sec, t->be->timeout.server.tv_usec);
|
||||
|
||||
fprintf(stderr,"%s:%d req->cto=%d.%d, req->rto=%d.%d, req->wto=%d.%d\n",
|
||||
__FUNCTION__, __LINE__,
|
||||
@ -2543,7 +2543,7 @@ int process_srv(struct session *t)
|
||||
tv_eternity(&req->wex);
|
||||
} else /* need the right to write */ {
|
||||
EV_FD_SET(t->srv_fd, DIR_WR);
|
||||
if (tv_add_ifset(&req->wex, &now, &t->be->srvtimeout)) {
|
||||
if (tv_add_ifset(&req->wex, &now, &t->be->timeout.server)) {
|
||||
/* FIXME: to prevent the server from expiring read timeouts during writes,
|
||||
* we refresh it. */
|
||||
rep->rex = req->wex;
|
||||
@ -2554,7 +2554,7 @@ int process_srv(struct session *t)
|
||||
|
||||
if (t->be->mode == PR_MODE_TCP) { /* let's allow immediate data connection in this case */
|
||||
EV_FD_SET(t->srv_fd, DIR_RD);
|
||||
if (!tv_add_ifset(&rep->rex, &now, &t->be->srvtimeout))
|
||||
if (!tv_add_ifset(&rep->rex, &now, &t->be->timeout.server))
|
||||
tv_eternity(&rep->rex);
|
||||
|
||||
t->srv_state = SV_STDATA;
|
||||
@ -2641,7 +2641,7 @@ int process_srv(struct session *t)
|
||||
* full. We cannot loop here since stream_sock_read will disable it only if
|
||||
* rep->l == rlim-data
|
||||
*/
|
||||
if (!tv_add_ifset(&rep->rex, &now, &t->be->srvtimeout))
|
||||
if (!tv_add_ifset(&rep->rex, &now, &t->be->timeout.server))
|
||||
tv_eternity(&rep->rex);
|
||||
}
|
||||
|
||||
@ -2746,7 +2746,7 @@ int process_srv(struct session *t)
|
||||
/* We must ensure that the read part is still
|
||||
* alive when switching to shutw */
|
||||
EV_FD_SET(t->srv_fd, DIR_RD);
|
||||
tv_add_ifset(&rep->rex, &now, &t->be->srvtimeout);
|
||||
tv_add_ifset(&rep->rex, &now, &t->be->timeout.server);
|
||||
|
||||
shutdown(t->srv_fd, SHUT_WR);
|
||||
t->srv_state = SV_STSHUTW;
|
||||
@ -2766,7 +2766,7 @@ int process_srv(struct session *t)
|
||||
/* We must ensure that the read part is still alive
|
||||
* when switching to shutw */
|
||||
EV_FD_SET(t->srv_fd, DIR_RD);
|
||||
tv_add_ifset(&rep->rex, &now, &t->be->srvtimeout);
|
||||
tv_add_ifset(&rep->rex, &now, &t->be->timeout.server);
|
||||
|
||||
t->srv_state = SV_STSHUTW;
|
||||
if (!(t->flags & SN_ERR_MASK))
|
||||
@ -2787,7 +2787,7 @@ int process_srv(struct session *t)
|
||||
else if (likely(req->l)) {
|
||||
if (EV_FD_COND_S(t->srv_fd, DIR_WR)) {
|
||||
/* restart writing */
|
||||
if (tv_add_ifset(&req->wex, &now, &t->be->srvtimeout)) {
|
||||
if (tv_add_ifset(&req->wex, &now, &t->be->timeout.server)) {
|
||||
/* FIXME: to prevent the server from expiring read timeouts during writes,
|
||||
* we refresh it. */
|
||||
rep->rex = req->wex;
|
||||
@ -3089,7 +3089,7 @@ int process_srv(struct session *t)
|
||||
/* We must ensure that the read part is still alive when switching
|
||||
* to shutw */
|
||||
EV_FD_SET(t->srv_fd, DIR_RD);
|
||||
tv_add_ifset(&rep->rex, &now, &t->be->srvtimeout);
|
||||
tv_add_ifset(&rep->rex, &now, &t->be->timeout.server);
|
||||
|
||||
shutdown(t->srv_fd, SHUT_WR);
|
||||
t->srv_state = SV_STSHUTW;
|
||||
@ -3159,7 +3159,7 @@ int process_srv(struct session *t)
|
||||
/* We must ensure that the read part is still alive when switching
|
||||
* to shutw */
|
||||
EV_FD_SET(t->srv_fd, DIR_RD);
|
||||
tv_add_ifset(&rep->rex, &now, &t->be->srvtimeout);
|
||||
tv_add_ifset(&rep->rex, &now, &t->be->timeout.server);
|
||||
|
||||
t->srv_state = SV_STSHUTW;
|
||||
return 1;
|
||||
@ -3183,7 +3183,7 @@ int process_srv(struct session *t)
|
||||
/* We must ensure that the read part is still alive when switching
|
||||
* to shutw */
|
||||
EV_FD_SET(t->srv_fd, DIR_RD);
|
||||
tv_add_ifset(&rep->rex, &now, &t->be->srvtimeout);
|
||||
tv_add_ifset(&rep->rex, &now, &t->be->timeout.server);
|
||||
t->srv_state = SV_STSHUTW;
|
||||
if (!(t->flags & SN_ERR_MASK))
|
||||
t->flags |= SN_ERR_SRVTO;
|
||||
@ -3202,7 +3202,7 @@ int process_srv(struct session *t)
|
||||
else { /* buffer not empty, there are still data to be transferred */
|
||||
if (EV_FD_COND_S(t->srv_fd, DIR_WR)) {
|
||||
/* restart writing */
|
||||
if (tv_add_ifset(&req->wex, &now, &t->be->srvtimeout)) {
|
||||
if (tv_add_ifset(&req->wex, &now, &t->be->timeout.server)) {
|
||||
/* FIXME: to prevent the server from expiring read timeouts during writes,
|
||||
* we refresh it. */
|
||||
rep->rex = req->wex;
|
||||
@ -3220,7 +3220,7 @@ int process_srv(struct session *t)
|
||||
}
|
||||
else {
|
||||
if (EV_FD_COND_S(t->srv_fd, DIR_RD)) {
|
||||
if (!tv_add_ifset(&rep->rex, &now, &t->be->srvtimeout))
|
||||
if (!tv_add_ifset(&rep->rex, &now, &t->be->timeout.server))
|
||||
tv_eternity(&rep->rex);
|
||||
}
|
||||
}
|
||||
@ -3296,7 +3296,7 @@ int process_srv(struct session *t)
|
||||
else { /* buffer not empty */
|
||||
if (EV_FD_COND_S(t->srv_fd, DIR_WR)) {
|
||||
/* restart writing */
|
||||
if (!tv_add_ifset(&req->wex, &now, &t->be->srvtimeout))
|
||||
if (!tv_add_ifset(&req->wex, &now, &t->be->timeout.server))
|
||||
tv_eternity(&req->wex);
|
||||
}
|
||||
}
|
||||
@ -3369,7 +3369,7 @@ int process_srv(struct session *t)
|
||||
}
|
||||
else {
|
||||
if (EV_FD_COND_S(t->srv_fd, DIR_RD)) {
|
||||
if (!tv_add_ifset(&rep->rex, &now, &t->be->srvtimeout))
|
||||
if (!tv_add_ifset(&rep->rex, &now, &t->be->timeout.server))
|
||||
tv_eternity(&rep->rex);
|
||||
}
|
||||
}
|
||||
@ -3490,8 +3490,8 @@ int apply_filter_to_req_headers(struct session *t, struct buffer *req, struct hd
|
||||
* frontend, and the beconn will be updated later.
|
||||
*/
|
||||
|
||||
t->rep->rto = t->req->wto = t->be->srvtimeout;
|
||||
t->req->cto = t->be->contimeout;
|
||||
t->rep->rto = t->req->wto = t->be->timeout.server;
|
||||
t->req->cto = t->be->timeout.connect;
|
||||
t->conn_retries = t->be->conn_retries;
|
||||
last_hdr = 1;
|
||||
break;
|
||||
@ -3611,8 +3611,8 @@ int apply_filter_to_req_line(struct session *t, struct buffer *req, struct hdr_e
|
||||
* frontend, and the beconn will be updated later.
|
||||
*/
|
||||
|
||||
t->rep->rto = t->req->wto = t->be->srvtimeout;
|
||||
t->req->cto = t->be->contimeout;
|
||||
t->rep->rto = t->req->wto = t->be->timeout.server;
|
||||
t->req->cto = t->be->timeout.connect;
|
||||
t->conn_retries = t->be->conn_retries;
|
||||
done = 1;
|
||||
break;
|
||||
@ -4009,7 +4009,7 @@ void manage_client_side_cookies(struct session *t, struct buffer *req)
|
||||
}/* end while(srv) */
|
||||
}/* end else if server == NULL */
|
||||
|
||||
tv_add(&asession_temp->expire, &now, &t->be->appsession_timeout);
|
||||
tv_add(&asession_temp->expire, &now, &t->be->timeout.appsession);
|
||||
}/* end if ((t->proxy->appsession_name != NULL) ... */
|
||||
}
|
||||
|
||||
@ -4463,7 +4463,7 @@ void manage_server_side_cookies(struct session *t, struct buffer *rtr)
|
||||
if (asession_temp->serverid[0] == '\0')
|
||||
memcpy(asession_temp->serverid, t->srv->id, server_id_len);
|
||||
|
||||
tv_add(&asession_temp->expire, &now, &t->be->appsession_timeout);
|
||||
tv_add(&asession_temp->expire, &now, &t->be->timeout.appsession);
|
||||
|
||||
#if defined(DEBUG_HASH)
|
||||
appsession_hash_dump(&(t->be->htbl_proxy));
|
||||
@ -4625,7 +4625,7 @@ void get_srv_from_appsession(struct session *t, const char *begin, int len)
|
||||
pool_free2(apools.sessid, local_asession.sessid);
|
||||
}
|
||||
|
||||
tv_add(&asession_temp->expire, &now, &t->be->appsession_timeout);
|
||||
tv_add(&asession_temp->expire, &now, &t->be->timeout.appsession);
|
||||
asession_temp->request_count++;
|
||||
|
||||
#if defined(DEBUG_HASH)
|
||||
|
16
src/proxy.c
16
src/proxy.c
@ -97,8 +97,8 @@ int proxy_parse_timeout(const char **args, struct proxy *proxy,
|
||||
name = args[0];
|
||||
if (!strcmp(args[0], "client") || !strcmp(args[0], "clitimeout")) {
|
||||
name = "client";
|
||||
tv = &proxy->clitimeout;
|
||||
td = &defpx->clitimeout;
|
||||
tv = &proxy->timeout.client;
|
||||
td = &defpx->timeout.client;
|
||||
cap = PR_CAP_FE;
|
||||
} else if (!strcmp(args[0], "tarpit")) {
|
||||
tv = &proxy->timeout.tarpit;
|
||||
@ -106,17 +106,17 @@ int proxy_parse_timeout(const char **args, struct proxy *proxy,
|
||||
cap = PR_CAP_FE;
|
||||
} else if (!strcmp(args[0], "server") || !strcmp(args[0], "srvtimeout")) {
|
||||
name = "server";
|
||||
tv = &proxy->srvtimeout;
|
||||
td = &defpx->srvtimeout;
|
||||
tv = &proxy->timeout.server;
|
||||
td = &defpx->timeout.server;
|
||||
cap = PR_CAP_BE;
|
||||
} else if (!strcmp(args[0], "connect") || !strcmp(args[0], "contimeout")) {
|
||||
name = "connect";
|
||||
tv = &proxy->contimeout;
|
||||
td = &defpx->contimeout;
|
||||
tv = &proxy->timeout.connect;
|
||||
td = &defpx->timeout.connect;
|
||||
cap = PR_CAP_BE;
|
||||
} else if (!strcmp(args[0], "appsession")) {
|
||||
tv = &proxy->appsession_timeout;
|
||||
td = &defpx->appsession_timeout;
|
||||
tv = &proxy->timeout.appsession;
|
||||
td = &defpx->timeout.appsession;
|
||||
cap = PR_CAP_BE;
|
||||
} else if (!strcmp(args[0], "queue")) {
|
||||
tv = &proxy->timeout.queue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user