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);
}
/* 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);
}
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;
}
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;
}
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);
}
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"
*/
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) ||
*/
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;
}
}
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;
* 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;
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;
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;
}
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
/* 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;
/* 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))
} 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
*/
tv_eternity(&req->rex);
else
- tv_add(&req->rex, &now, &t->fe->clitimeout);
+ tv_add(&req->rex, &now, &t->fe->timeout.client);
}
}
/* 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;
/* 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);
}
}
} 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);
}
#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__,
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;
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;
* 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);
}
/* 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;
/* 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))
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;
/* 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;
/* 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;
/* 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;
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;
}
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);
}
}
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);
}
}
}
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);
}
}
* 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;
* 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;
}/* 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) ... */
}
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));
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)