s->cli_state = CL_STDATA;
s->req = s->rep = NULL; /* will be allocated later */
- s->si[0].state = SI_ST_EST;
+ s->si[0].state = s->si[0].prev_state = SI_ST_EST;
s->si[0].err_type = SI_ET_NONE;
s->si[0].err_loc = NULL;
s->si[0].owner = t;
s->si[0].shutw = stream_sock_shutw;
s->si[0].fd = cfd;
+ s->si[0].exp = TICK_ETERNITY;
s->cli_fd = cfd;
- s->si[1].state = SI_ST_INI;
+ s->si[1].state = s->si[1].prev_state = SI_ST_INI;
s->si[1].err_type = SI_ET_NONE;
s->si[1].err_loc = NULL;
s->si[1].owner = t;
s->si[1].shutw = stream_sock_shutw;
+ s->si[1].exp = TICK_ETERNITY;
s->si[1].fd = -1; /* just to help with debugging */
s->srv = s->prev_srv = s->srv_conn = NULL;
if (tick_is_expired(s->req->analyse_exp, now_ms))
s->req->flags |= BF_ANA_TIMEOUT;
}
+ /* Note that we don't check nor indicate if we wake up because
+ * of a timeout on a stream interface.
+ */
}
/* Check if we need to close the write side. This can only happen
if (s->req->analysers)
t->expire = tick_first(t->expire, s->req->analyse_exp);
+ if (s->si[0].exp)
+ t->expire = tick_first(t->expire, s->si[0].exp);
+
+ if (s->si[1].exp)
+ t->expire = tick_first(t->expire, s->si[1].exp);
+
#ifdef DEBUG_FULL
fprintf(stderr, "[%u] queuing with exp=%u req->rex=%u req->wex=%u req->ana_exp=%u rep->rex=%u rep->wex=%u\n",
now_ms, t->expire, s->req->rex, s->req->wex, s->req->analyse_exp, s->rep->rex, s->rep->wex);
* time of 1 second. We will wait in the previous if block.
*/
req->cons->state = SI_ST_TAR;
- req->wex = tick_add(now_ms, MS_TO_TICKS(1000));
+ req->cons->exp = tick_add(now_ms, MS_TO_TICKS(1000));
return 0;
}
(t->req->flags & BF_EMPTY || t->be->options & PR_O_ABRT_CLOSE))) { /* give up */
trace_term(t, TT_HTTP_SRV_1);
- t->req->wex = TICK_ETERNITY;
+ t->req->cons->exp = TICK_ETERNITY;
// FIXME: should we set rep->MAY_FORWARD ?
buffer_shutr(t->rep);
return 0;
}
- if (!tick_is_expired(t->req->wex, now_ms))
+ if (!tick_is_expired(t->req->cons->exp, now_ms))
return 0; /* still in turn-around */
t->req->cons->state = SI_ST_INI;
+ t->req->cons->exp = TICK_ETERNITY;
}
else if (t->req->cons->state == SI_ST_QUE) {
if (t->pend_pos) {
/* request still in queue... */
- if (tick_is_expired(t->req->wex, now_ms)) {
+ if (tick_is_expired(t->req->cons->exp, now_ms)) {
/* ... and timeout expired */
trace_term(t, TT_HTTP_SRV_3);
- t->req->wex = TICK_ETERNITY;
+ t->req->cons->exp = TICK_ETERNITY;
t->logs.t_queue = tv_ms_elapsed(&t->logs.tv_accept, &now);
if (t->srv)
t->srv->failed_conns++;
(t->req->flags & BF_EMPTY || t->be->options & PR_O_ABRT_CLOSE))) {
/* give up */
trace_term(t, TT_HTTP_SRV_1);
- t->req->wex = TICK_ETERNITY;
+ t->req->cons->exp = TICK_ETERNITY;
t->logs.t_queue = tv_ms_elapsed(&t->logs.tv_accept, &now);
// FIXME: should we set rep->MAY_FORWARD ?
}
/* The connection is not in the queue anymore */
t->req->cons->state = SI_ST_INI;
+ t->req->cons->exp = TICK_ETERNITY;
}
/* we may get here from above */
(t->req->flags & BF_EMPTY || t->be->options & PR_O_ABRT_CLOSE))) { /* give up */
trace_term(t, TT_HTTP_SRV_1);
- t->req->wex = TICK_ETERNITY;
// FIXME: should we set rep->MAY_FORWARD ?
buffer_shutr(t->rep);
}
trace_term(t, TT_HTTP_SRV_2);
- t->req->wex = TICK_ETERNITY;
// FIXME: should we set rep->MAY_FORWARD ?
buffer_shutr(t->rep);
if (t->req->cons->state != SI_ST_CON) {
/* it was an error */
trace_term(t, TT_HTTP_SRV_4);
- t->req->wex = TICK_ETERNITY;
// FIXME: should we set rep->MAY_FORWARD ?
buffer_shutr(t->rep);