mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
MEDIUM: channel/stconn: Move rex/wex timer from the channel to the sedesc
These timers are related to the I/O. Thus it is logical to move them into the SE descriptor. The patch is a bit huge but it is just a replacement. However it is error-prone. From the stconn or the stream, helper functions are used to get, set or reset these timers. This simplify the timers manipulations.
This commit is contained in:
parent
ed7e66fe1a
commit
f8413cba2a
@ -251,8 +251,6 @@ struct channel {
|
|||||||
unsigned char xfer_large; /* number of consecutive large xfers */
|
unsigned char xfer_large; /* number of consecutive large xfers */
|
||||||
unsigned char xfer_small; /* number of consecutive small xfers */
|
unsigned char xfer_small; /* number of consecutive small xfers */
|
||||||
unsigned long long total; /* total data read */
|
unsigned long long total; /* total data read */
|
||||||
int rex; /* expiration date for a read, in ticks */
|
|
||||||
int wex; /* expiration date for a write or connect, in ticks */
|
|
||||||
int analyse_exp; /* expiration date for current analysers (if set) */
|
int analyse_exp; /* expiration date for current analysers (if set) */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -531,11 +531,11 @@ static inline int channel_output_closed(struct channel *chn)
|
|||||||
static inline void channel_check_timeouts(struct channel *chn)
|
static inline void channel_check_timeouts(struct channel *chn)
|
||||||
{
|
{
|
||||||
if (likely(!(chn->flags & (CF_SHUTR|CF_READ_TIMEOUT|CF_READ_EVENT))) &&
|
if (likely(!(chn->flags & (CF_SHUTR|CF_READ_TIMEOUT|CF_READ_EVENT))) &&
|
||||||
unlikely(tick_is_expired(chn->rex, now_ms)))
|
unlikely(tick_is_expired(sc_ep_rex(chn_prod(chn)), now_ms)))
|
||||||
chn->flags |= CF_READ_TIMEOUT;
|
chn->flags |= CF_READ_TIMEOUT;
|
||||||
|
|
||||||
if (likely(!(chn->flags & (CF_SHUTW|CF_WRITE_TIMEOUT|CF_WRITE_EVENT))) &&
|
if (likely(!(chn->flags & (CF_SHUTW|CF_WRITE_TIMEOUT|CF_WRITE_EVENT))) &&
|
||||||
unlikely(tick_is_expired(chn->wex, now_ms)))
|
unlikely(tick_is_expired(sc_ep_wex(chn_cons(chn)), now_ms)))
|
||||||
chn->flags |= CF_WRITE_TIMEOUT;
|
chn->flags |= CF_WRITE_TIMEOUT;
|
||||||
|
|
||||||
if (likely(!(chn->flags & CF_READ_EVENT)) &&
|
if (likely(!(chn->flags & CF_READ_EVENT)) &&
|
||||||
|
@ -199,6 +199,8 @@ struct stconn;
|
|||||||
* <se> is the stream endpoint, i.e. the mux stream or the appctx
|
* <se> is the stream endpoint, i.e. the mux stream or the appctx
|
||||||
* <conn> is the connection for connection-based streams
|
* <conn> is the connection for connection-based streams
|
||||||
* <sc> is the stream connector we're attached to, or NULL
|
* <sc> is the stream connector we're attached to, or NULL
|
||||||
|
* <rex> is the expiration date for a read, in ticks
|
||||||
|
* <wex> is the expiration date for a write or connect, in ticks
|
||||||
* <flags> SE_FL_*
|
* <flags> SE_FL_*
|
||||||
*/
|
*/
|
||||||
struct sedesc {
|
struct sedesc {
|
||||||
@ -206,6 +208,8 @@ struct sedesc {
|
|||||||
struct connection *conn;
|
struct connection *conn;
|
||||||
struct stconn *sc;
|
struct stconn *sc;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
|
int rex;
|
||||||
|
int wex;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* sc_app_ops describes the application layer's operations and notification
|
/* sc_app_ops describes the application layer's operations and notification
|
||||||
|
@ -137,6 +137,37 @@ static forceinline uint sc_ep_get(const struct stconn *sc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static forceinline int sc_ep_rex(const struct stconn *sc)
|
||||||
|
{
|
||||||
|
return sc->sedesc->rex;
|
||||||
|
}
|
||||||
|
|
||||||
|
static forceinline int sc_ep_wex(const struct stconn *sc)
|
||||||
|
{
|
||||||
|
return sc->sedesc->wex;
|
||||||
|
}
|
||||||
|
|
||||||
|
static forceinline void sc_ep_reset_rex(struct stconn *sc)
|
||||||
|
{
|
||||||
|
sc->sedesc->rex = TICK_ETERNITY;
|
||||||
|
}
|
||||||
|
|
||||||
|
static forceinline void sc_ep_reset_wex(struct stconn *sc)
|
||||||
|
{
|
||||||
|
sc->sedesc->wex = TICK_ETERNITY;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static forceinline void sc_ep_set_rex(struct stconn *sc, unsigned int rto)
|
||||||
|
{
|
||||||
|
sc->sedesc->rex = tick_add_ifset(now_ms, rto);
|
||||||
|
}
|
||||||
|
|
||||||
|
static forceinline void sc_ep_set_wex(struct stconn *sc, unsigned int wto)
|
||||||
|
{
|
||||||
|
sc->sedesc->wex = tick_add_ifset(now_ms, wto);
|
||||||
|
}
|
||||||
|
|
||||||
/* Returns the stream endpoint from an connector, without any control */
|
/* Returns the stream endpoint from an connector, without any control */
|
||||||
static inline void *__sc_endp(const struct stconn *sc)
|
static inline void *__sc_endp(const struct stconn *sc)
|
||||||
{
|
{
|
||||||
|
@ -2831,11 +2831,12 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
s->scb->rto = TICK_ETERNITY;
|
s->scb->rto = TICK_ETERNITY;
|
||||||
s->scb->wto = TICK_ETERNITY;
|
s->scb->wto = TICK_ETERNITY;
|
||||||
|
|
||||||
s->req.rex = TICK_ETERNITY;
|
sc_ep_reset_rex(s->scf);
|
||||||
s->req.wex = TICK_ETERNITY;
|
sc_ep_reset_wex(s->scf);
|
||||||
s->req.analyse_exp = TICK_ETERNITY;
|
s->req.analyse_exp = TICK_ETERNITY;
|
||||||
s->res.rex = TICK_ETERNITY;
|
|
||||||
s->res.wex = TICK_ETERNITY;
|
sc_ep_reset_rex(s->scb);
|
||||||
|
sc_ep_reset_wex(s->scb);
|
||||||
s->res.analyse_exp = TICK_ETERNITY;
|
s->res.analyse_exp = TICK_ETERNITY;
|
||||||
s->scb->hcto = TICK_ETERNITY;
|
s->scb->hcto = TICK_ETERNITY;
|
||||||
|
|
||||||
|
21
src/debug.c
21
src/debug.c
@ -760,8 +760,9 @@ static int debug_parse_cli_stream(char **args, char *payload, struct appctx *app
|
|||||||
if (!*args[3]) {
|
if (!*args[3]) {
|
||||||
return cli_err(appctx,
|
return cli_err(appctx,
|
||||||
"Usage: debug dev stream { <obj> <op> <value> | wake }*\n"
|
"Usage: debug dev stream { <obj> <op> <value> | wake }*\n"
|
||||||
" <obj> = {strm | strm.f | strm.x | scf.s | scb.s |\n"
|
" <obj> = {strm | strm.f | strm.x |\n"
|
||||||
" txn.f | req.f | req.r | req.w | res.f | res.r | res.w}\n"
|
" scf.s | scf.r | scf.w | scb.s | scb.r | scb.w |\n"
|
||||||
|
" txn.f | req.f | res.f}\n"
|
||||||
" <op> = {'' (show) | '=' (assign) | '^' (xor) | '+' (or) | '-' (andnot)}\n"
|
" <op> = {'' (show) | '=' (assign) | '^' (xor) | '+' (or) | '-' (andnot)}\n"
|
||||||
" <value> = 'now' | 64-bit dec/hex integer (0x prefix supported)\n"
|
" <value> = 'now' | 64-bit dec/hex integer (0x prefix supported)\n"
|
||||||
" 'wake' wakes the stream asssigned to 'strm' (default: current)\n"
|
" 'wake' wakes the stream asssigned to 'strm' (default: current)\n"
|
||||||
@ -787,18 +788,18 @@ static int debug_parse_cli_stream(char **args, char *payload, struct appctx *app
|
|||||||
ptr = (!s || !may_access(s)) ? NULL : &s->req.flags; size = sizeof(s->req.flags);
|
ptr = (!s || !may_access(s)) ? NULL : &s->req.flags; size = sizeof(s->req.flags);
|
||||||
} else if (isteq(name, ist("res.f"))) {
|
} else if (isteq(name, ist("res.f"))) {
|
||||||
ptr = (!s || !may_access(s)) ? NULL : &s->res.flags; size = sizeof(s->res.flags);
|
ptr = (!s || !may_access(s)) ? NULL : &s->res.flags; size = sizeof(s->res.flags);
|
||||||
} else if (isteq(name, ist("req.r"))) {
|
|
||||||
ptr = (!s || !may_access(s)) ? NULL : &s->req.rex; size = sizeof(s->req.rex);
|
|
||||||
} else if (isteq(name, ist("res.r"))) {
|
|
||||||
ptr = (!s || !may_access(s)) ? NULL : &s->res.rex; size = sizeof(s->res.rex);
|
|
||||||
} else if (isteq(name, ist("req.w"))) {
|
|
||||||
ptr = (!s || !may_access(s)) ? NULL : &s->req.wex; size = sizeof(s->req.wex);
|
|
||||||
} else if (isteq(name, ist("res.w"))) {
|
|
||||||
ptr = (!s || !may_access(s)) ? NULL : &s->res.wex; size = sizeof(s->res.wex);
|
|
||||||
} else if (isteq(name, ist("scf.s"))) {
|
} else if (isteq(name, ist("scf.s"))) {
|
||||||
ptr = (!s || !may_access(s)) ? NULL : &s->scf->state; size = sizeof(s->scf->state);
|
ptr = (!s || !may_access(s)) ? NULL : &s->scf->state; size = sizeof(s->scf->state);
|
||||||
|
} else if (isteq(name, ist("scf.r"))) {
|
||||||
|
ptr = (!s || !may_access(s)) ? NULL : &s->scf->sedesc->rex; size = sizeof(s->scf->sedesc->rex);
|
||||||
|
} else if (isteq(name, ist("scf.w"))) {
|
||||||
|
ptr = (!s || !may_access(s)) ? NULL : &s->scf->sedesc->wex; size = sizeof(s->scf->sedesc->wex);
|
||||||
} else if (isteq(name, ist("scb.s"))) {
|
} else if (isteq(name, ist("scb.s"))) {
|
||||||
ptr = (!s || !may_access(s)) ? NULL : &s->scf->state; size = sizeof(s->scb->state);
|
ptr = (!s || !may_access(s)) ? NULL : &s->scf->state; size = sizeof(s->scb->state);
|
||||||
|
} else if (isteq(name, ist("scb.r"))) {
|
||||||
|
ptr = (!s || !may_access(s)) ? NULL : &s->scb->sedesc->rex; size = sizeof(s->scb->sedesc->rex);
|
||||||
|
} else if (isteq(name, ist("scb.w"))) {
|
||||||
|
ptr = (!s || !may_access(s)) ? NULL : &s->scb->sedesc->wex; size = sizeof(s->scb->sedesc->wex);
|
||||||
} else if (isteq(name, ist("wake"))) {
|
} else if (isteq(name, ist("wake"))) {
|
||||||
if (s && may_access(s) && may_access((void *)s + sizeof(*s) - 1))
|
if (s && may_access(s) && may_access((void *)s + sizeof(*s) - 1))
|
||||||
task_wakeup(s->task, TASK_WOKEN_TIMER|TASK_WOKEN_IO|TASK_WOKEN_MSG);
|
task_wakeup(s->task, TASK_WOKEN_TIMER|TASK_WOKEN_IO|TASK_WOKEN_MSG);
|
||||||
|
@ -839,7 +839,7 @@ static int dns_session_init(struct appctx *appctx)
|
|||||||
* We are using a syslog server.
|
* We are using a syslog server.
|
||||||
*/
|
*/
|
||||||
s->scb->rto = TICK_ETERNITY;
|
s->scb->rto = TICK_ETERNITY;
|
||||||
s->res.rex = TICK_ETERNITY;
|
sc_ep_reset_rex(s->scb);
|
||||||
|
|
||||||
ds->appctx = appctx;
|
ds->appctx = appctx;
|
||||||
return 0;
|
return 0;
|
||||||
|
14
src/hlua.c
14
src/hlua.c
@ -2524,8 +2524,8 @@ static int hlua_socket_write_yield(struct lua_State *L,int status, lua_KContext
|
|||||||
/* update buffers. */
|
/* update buffers. */
|
||||||
appctx_wakeup(appctx);
|
appctx_wakeup(appctx);
|
||||||
|
|
||||||
s->req.rex = TICK_ETERNITY;
|
sc_ep_reset_rex(s->scf);;
|
||||||
s->res.wex = TICK_ETERNITY;
|
sc_ep_reset_wex(s->scb);
|
||||||
|
|
||||||
/* Update length sent. */
|
/* Update length sent. */
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
@ -3018,10 +3018,10 @@ __LJMP static int hlua_socket_settimeout(struct lua_State *L)
|
|||||||
s->sess->fe->timeout.connect = tmout;
|
s->sess->fe->timeout.connect = tmout;
|
||||||
s->scf->rto = s->scf->wto = tmout;
|
s->scf->rto = s->scf->wto = tmout;
|
||||||
s->scb->rto = s->scb->wto = tmout;
|
s->scb->rto = s->scb->wto = tmout;
|
||||||
s->req.rex = tick_add_ifset(now_ms, tmout);
|
sc_ep_set_rex(s->scf, tmout);
|
||||||
s->req.wex = tick_add_ifset(now_ms, tmout);
|
sc_ep_set_wex(s->scf, tmout);
|
||||||
s->res.rex = tick_add_ifset(now_ms, tmout);
|
sc_ep_set_rex(s->scb, tmout);
|
||||||
s->res.wex = tick_add_ifset(now_ms, tmout);
|
sc_ep_set_wex(s->scb, tmout);
|
||||||
|
|
||||||
s->task->expire = tick_add_ifset(now_ms, tmout);
|
s->task->expire = tick_add_ifset(now_ms, tmout);
|
||||||
task_queue(s->task);
|
task_queue(s->task);
|
||||||
@ -8084,7 +8084,7 @@ __LJMP static int hlua_txn_done(lua_State *L)
|
|||||||
channel_auto_close(req);
|
channel_auto_close(req);
|
||||||
channel_erase(req);
|
channel_erase(req);
|
||||||
|
|
||||||
res->wex = tick_add_ifset(now_ms, s->scf->wto);
|
sc_ep_set_wex(s->scb, s->scf->wto);
|
||||||
channel_auto_read(res);
|
channel_auto_read(res);
|
||||||
channel_auto_close(res);
|
channel_auto_close(res);
|
||||||
channel_shutr_now(res);
|
channel_shutr_now(res);
|
||||||
|
@ -1141,7 +1141,6 @@ static __inline int do_l7_retry(struct stream *s, struct stconn *sc)
|
|||||||
s->flags &= ~(SF_CONN_EXP | SF_ERR_MASK | SF_FINST_MASK);
|
s->flags &= ~(SF_CONN_EXP | SF_ERR_MASK | SF_FINST_MASK);
|
||||||
s->conn_exp = TICK_ETERNITY;
|
s->conn_exp = TICK_ETERNITY;
|
||||||
stream_choose_redispatch(s);
|
stream_choose_redispatch(s);
|
||||||
res->rex = TICK_ETERNITY;
|
|
||||||
res->to_forward = 0;
|
res->to_forward = 0;
|
||||||
res->analyse_exp = TICK_ETERNITY;
|
res->analyse_exp = TICK_ETERNITY;
|
||||||
res->total = 0;
|
res->total = 0;
|
||||||
@ -4439,7 +4438,7 @@ int http_forward_proxy_resp(struct stream *s, int final)
|
|||||||
channel_auto_close(req);
|
channel_auto_close(req);
|
||||||
channel_htx_erase(req, htxbuf(&req->buf));
|
channel_htx_erase(req, htxbuf(&req->buf));
|
||||||
|
|
||||||
res->wex = tick_add_ifset(now_ms, s->scf->wto);
|
sc_ep_set_wex(s->scb, s->scf->wto);
|
||||||
channel_auto_read(res);
|
channel_auto_read(res);
|
||||||
channel_auto_close(res);
|
channel_auto_close(res);
|
||||||
channel_shutr_now(res);
|
channel_shutr_now(res);
|
||||||
@ -4493,7 +4492,7 @@ void http_reply_and_close(struct stream *s, short status, struct http_reply *msg
|
|||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
s->res.wex = tick_add_ifset(now_ms, s->scf->wto);
|
sc_ep_set_wex(s->scb, s->scf->wto);
|
||||||
|
|
||||||
/* At this staged, HTTP analysis is finished */
|
/* At this staged, HTTP analysis is finished */
|
||||||
s->req.analysers &= AN_REQ_FLT_END;
|
s->req.analysers &= AN_REQ_FLT_END;
|
||||||
|
@ -326,7 +326,7 @@ static void sink_forward_io_handler(struct appctx *appctx)
|
|||||||
* and we don't want expire on this case
|
* and we don't want expire on this case
|
||||||
* with a syslog server
|
* with a syslog server
|
||||||
*/
|
*/
|
||||||
sc_oc(sc)->rex = TICK_ETERNITY;
|
sc_ep_reset_rex(sc_opposite(sc));
|
||||||
/* rto should not change but it seems the case */
|
/* rto should not change but it seems the case */
|
||||||
sc_opposite(sc)->rto = TICK_ETERNITY;
|
sc_opposite(sc)->rto = TICK_ETERNITY;
|
||||||
|
|
||||||
@ -474,7 +474,7 @@ static void sink_forward_oc_io_handler(struct appctx *appctx)
|
|||||||
* and we don't want expire on this case
|
* and we don't want expire on this case
|
||||||
* with a syslog server
|
* with a syslog server
|
||||||
*/
|
*/
|
||||||
sc_oc(sc)->rex = TICK_ETERNITY;
|
sc_ep_reset_rex(sc_opposite(sc));
|
||||||
/* rto should not change but it seems the case */
|
/* rto should not change but it seems the case */
|
||||||
sc_opposite(sc)->rto = TICK_ETERNITY;
|
sc_opposite(sc)->rto = TICK_ETERNITY;
|
||||||
|
|
||||||
@ -636,7 +636,7 @@ static int sink_forward_session_init(struct appctx *appctx)
|
|||||||
* We are using a syslog server.
|
* We are using a syslog server.
|
||||||
*/
|
*/
|
||||||
s->scb->rto = TICK_ETERNITY;
|
s->scb->rto = TICK_ETERNITY;
|
||||||
s->res.rex = TICK_ETERNITY;
|
sc_ep_reset_rex(s->scb);
|
||||||
sft->appctx = appctx;
|
sft->appctx = appctx;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
88
src/stconn.c
88
src/stconn.c
@ -92,6 +92,7 @@ void sedesc_init(struct sedesc *sedesc)
|
|||||||
sedesc->se = NULL;
|
sedesc->se = NULL;
|
||||||
sedesc->conn = NULL;
|
sedesc->conn = NULL;
|
||||||
sedesc->sc = NULL;
|
sedesc->sc = NULL;
|
||||||
|
sedesc->rex = sedesc->wex = TICK_ETERNITY;
|
||||||
se_fl_setall(sedesc, SE_FL_NONE);
|
se_fl_setall(sedesc, SE_FL_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,7 +533,7 @@ static void sc_app_shutr(struct stconn *sc)
|
|||||||
if (ic->flags & CF_SHUTR)
|
if (ic->flags & CF_SHUTR)
|
||||||
return;
|
return;
|
||||||
ic->flags |= CF_SHUTR;
|
ic->flags |= CF_SHUTR;
|
||||||
ic->rex = TICK_ETERNITY;
|
sc_ep_reset_rex(sc);
|
||||||
|
|
||||||
if (!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
|
if (!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
|
||||||
return;
|
return;
|
||||||
@ -566,11 +567,11 @@ static void sc_app_shutw(struct stconn *sc)
|
|||||||
if (oc->flags & CF_SHUTW)
|
if (oc->flags & CF_SHUTW)
|
||||||
return;
|
return;
|
||||||
oc->flags |= CF_SHUTW;
|
oc->flags |= CF_SHUTW;
|
||||||
oc->wex = TICK_ETERNITY;
|
sc_ep_reset_wex(sc);
|
||||||
|
|
||||||
if (tick_isset(sc->hcto)) {
|
if (tick_isset(sc->hcto)) {
|
||||||
sc->rto = sc->hcto;
|
sc->rto = sc->hcto;
|
||||||
ic->rex = tick_add(now_ms, sc->rto);
|
sc_ep_set_rex(sc, sc->rto);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (sc->state) {
|
switch (sc->state) {
|
||||||
@ -597,7 +598,7 @@ static void sc_app_shutw(struct stconn *sc)
|
|||||||
default:
|
default:
|
||||||
sc->flags &= ~SC_FL_NOLINGER;
|
sc->flags &= ~SC_FL_NOLINGER;
|
||||||
ic->flags |= CF_SHUTR;
|
ic->flags |= CF_SHUTR;
|
||||||
ic->rex = TICK_ETERNITY;
|
sc_ep_reset_rex(sc);
|
||||||
if (sc->flags & SC_FL_ISBACK)
|
if (sc->flags & SC_FL_ISBACK)
|
||||||
__sc_strm(sc)->conn_exp = TICK_ETERNITY;
|
__sc_strm(sc)->conn_exp = TICK_ETERNITY;
|
||||||
}
|
}
|
||||||
@ -647,8 +648,8 @@ static void sc_app_chk_snd(struct stconn *sc)
|
|||||||
* so we tell the handler.
|
* so we tell the handler.
|
||||||
*/
|
*/
|
||||||
sc_ep_clr(sc, SE_FL_WAIT_DATA);
|
sc_ep_clr(sc, SE_FL_WAIT_DATA);
|
||||||
if (!tick_isset(oc->wex))
|
if (!tick_isset(sc_ep_wex(sc)))
|
||||||
oc->wex = tick_add_ifset(now_ms, sc->wto);
|
sc_ep_set_wex(sc, sc->wto);
|
||||||
|
|
||||||
if (!(sc->flags & SC_FL_DONT_WAKE))
|
if (!(sc->flags & SC_FL_DONT_WAKE))
|
||||||
task_wakeup(sc_strm_task(sc), TASK_WOKEN_IO);
|
task_wakeup(sc_strm_task(sc), TASK_WOKEN_IO);
|
||||||
@ -673,7 +674,7 @@ static void sc_app_shutr_conn(struct stconn *sc)
|
|||||||
if (ic->flags & CF_SHUTR)
|
if (ic->flags & CF_SHUTR)
|
||||||
return;
|
return;
|
||||||
ic->flags |= CF_SHUTR;
|
ic->flags |= CF_SHUTR;
|
||||||
ic->rex = TICK_ETERNITY;
|
sc_ep_reset_rex(sc);
|
||||||
|
|
||||||
if (!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
|
if (!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
|
||||||
return;
|
return;
|
||||||
@ -707,11 +708,11 @@ static void sc_app_shutw_conn(struct stconn *sc)
|
|||||||
if (oc->flags & CF_SHUTW)
|
if (oc->flags & CF_SHUTW)
|
||||||
return;
|
return;
|
||||||
oc->flags |= CF_SHUTW;
|
oc->flags |= CF_SHUTW;
|
||||||
oc->wex = TICK_ETERNITY;
|
sc_ep_reset_wex(sc);
|
||||||
|
|
||||||
if (tick_isset(sc->hcto)) {
|
if (tick_isset(sc->hcto)) {
|
||||||
sc->rto = sc->hcto;
|
sc->rto = sc->hcto;
|
||||||
ic->rex = tick_add(now_ms, sc->rto);
|
sc_ep_set_rex(sc, sc->rto);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (sc->state) {
|
switch (sc->state) {
|
||||||
@ -763,7 +764,7 @@ static void sc_app_shutw_conn(struct stconn *sc)
|
|||||||
default:
|
default:
|
||||||
sc->flags &= ~SC_FL_NOLINGER;
|
sc->flags &= ~SC_FL_NOLINGER;
|
||||||
ic->flags |= CF_SHUTR;
|
ic->flags |= CF_SHUTR;
|
||||||
ic->rex = TICK_ETERNITY;
|
sc_ep_reset_rex(sc);
|
||||||
if (sc->flags & SC_FL_ISBACK)
|
if (sc->flags & SC_FL_ISBACK)
|
||||||
__sc_strm(sc)->conn_exp = TICK_ETERNITY;
|
__sc_strm(sc)->conn_exp = TICK_ETERNITY;
|
||||||
}
|
}
|
||||||
@ -835,25 +836,23 @@ static void sc_app_chk_snd_conn(struct stconn *sc)
|
|||||||
|
|
||||||
if ((oc->flags & (CF_SHUTW|CF_SHUTW_NOW)) == 0)
|
if ((oc->flags & (CF_SHUTW|CF_SHUTW_NOW)) == 0)
|
||||||
sc_ep_set(sc, SE_FL_WAIT_DATA);
|
sc_ep_set(sc, SE_FL_WAIT_DATA);
|
||||||
oc->wex = TICK_ETERNITY;
|
sc_ep_reset_wex(sc);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Otherwise there are remaining data to be sent in the buffer,
|
/* Otherwise there are remaining data to be sent in the buffer,
|
||||||
* which means we have to poll before doing so.
|
* which means we have to poll before doing so.
|
||||||
*/
|
*/
|
||||||
sc_ep_clr(sc, SE_FL_WAIT_DATA);
|
sc_ep_clr(sc, SE_FL_WAIT_DATA);
|
||||||
if (!tick_isset(oc->wex))
|
if (!tick_isset(sc_ep_wex(sc)))
|
||||||
oc->wex = tick_add_ifset(now_ms, sc->wto);
|
sc_ep_set_wex(sc, sc->wto);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (likely(oc->flags & CF_WRITE_EVENT)) {
|
if (likely(oc->flags & CF_WRITE_EVENT)) {
|
||||||
struct channel *ic = sc_ic(sc);
|
|
||||||
|
|
||||||
/* update timeout if we have written something */
|
/* update timeout if we have written something */
|
||||||
if (!(oc->flags & CF_SHUTW) && !channel_is_empty(oc))
|
if (!(oc->flags & CF_SHUTW) && !channel_is_empty(oc))
|
||||||
oc->wex = tick_add_ifset(now_ms, sc->wto);
|
sc_ep_set_wex(sc, sc->wto);
|
||||||
|
|
||||||
if (tick_isset(ic->rex) && !(sc->flags & SC_FL_INDEP_STR)) {
|
if (tick_isset(sc_ep_rex(sc)) && !(sc->flags & SC_FL_INDEP_STR)) {
|
||||||
/* Note: to prevent the client from expiring read timeouts
|
/* Note: to prevent the client from expiring read timeouts
|
||||||
* during writes, we refresh it. We only do this if the
|
* during writes, we refresh it. We only do this if the
|
||||||
* interface is not configured for "independent streams",
|
* interface is not configured for "independent streams",
|
||||||
@ -862,7 +861,7 @@ static void sc_app_chk_snd_conn(struct stconn *sc)
|
|||||||
* of data which can full the socket buffers long before a
|
* of data which can full the socket buffers long before a
|
||||||
* write timeout is detected.
|
* write timeout is detected.
|
||||||
*/
|
*/
|
||||||
ic->rex = tick_add_ifset(now_ms, sc->rto);
|
sc_ep_set_rex(sc, sc->rto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -897,7 +896,7 @@ static void sc_app_shutr_applet(struct stconn *sc)
|
|||||||
if (ic->flags & CF_SHUTR)
|
if (ic->flags & CF_SHUTR)
|
||||||
return;
|
return;
|
||||||
ic->flags |= CF_SHUTR;
|
ic->flags |= CF_SHUTR;
|
||||||
ic->rex = TICK_ETERNITY;
|
sc_ep_reset_rex(sc);
|
||||||
|
|
||||||
/* Note: on shutr, we don't call the applet */
|
/* Note: on shutr, we don't call the applet */
|
||||||
|
|
||||||
@ -932,11 +931,11 @@ static void sc_app_shutw_applet(struct stconn *sc)
|
|||||||
if (oc->flags & CF_SHUTW)
|
if (oc->flags & CF_SHUTW)
|
||||||
return;
|
return;
|
||||||
oc->flags |= CF_SHUTW;
|
oc->flags |= CF_SHUTW;
|
||||||
oc->wex = TICK_ETERNITY;
|
sc_ep_reset_wex(sc);
|
||||||
|
|
||||||
if (tick_isset(sc->hcto)) {
|
if (tick_isset(sc->hcto)) {
|
||||||
sc->rto = sc->hcto;
|
sc->rto = sc->hcto;
|
||||||
ic->rex = tick_add(now_ms, sc->rto);
|
sc_ep_set_rex(sc, sc->rto);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* on shutw we always wake the applet up */
|
/* on shutw we always wake the applet up */
|
||||||
@ -967,7 +966,7 @@ static void sc_app_shutw_applet(struct stconn *sc)
|
|||||||
default:
|
default:
|
||||||
sc->flags &= ~SC_FL_NOLINGER;
|
sc->flags &= ~SC_FL_NOLINGER;
|
||||||
ic->flags |= CF_SHUTR;
|
ic->flags |= CF_SHUTR;
|
||||||
ic->rex = TICK_ETERNITY;
|
sc_ep_reset_rex(sc);
|
||||||
if (sc->flags & SC_FL_ISBACK)
|
if (sc->flags & SC_FL_ISBACK)
|
||||||
__sc_strm(sc)->conn_exp = TICK_ETERNITY;
|
__sc_strm(sc)->conn_exp = TICK_ETERNITY;
|
||||||
}
|
}
|
||||||
@ -1008,8 +1007,8 @@ static void sc_app_chk_snd_applet(struct stconn *sc)
|
|||||||
if (!sc_ep_test(sc, SE_FL_WAIT_DATA) || sc_ep_test(sc, SE_FL_WONT_CONSUME))
|
if (!sc_ep_test(sc, SE_FL_WAIT_DATA) || sc_ep_test(sc, SE_FL_WONT_CONSUME))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!tick_isset(oc->wex))
|
if (!tick_isset(sc_ep_wex(sc)))
|
||||||
oc->wex = tick_add_ifset(now_ms, sc->wto);
|
sc_ep_set_wex(sc, sc->wto);
|
||||||
|
|
||||||
if (!channel_is_empty(oc)) {
|
if (!channel_is_empty(oc)) {
|
||||||
/* (re)start sending */
|
/* (re)start sending */
|
||||||
@ -1041,9 +1040,9 @@ void sc_update_rx(struct stconn *sc)
|
|||||||
sc_will_read(sc);
|
sc_will_read(sc);
|
||||||
|
|
||||||
if ((ic->flags & CF_EOI) || sc->flags & (SC_FL_WONT_READ|SC_FL_NEED_BUFF|SC_FL_NEED_ROOM))
|
if ((ic->flags & CF_EOI) || sc->flags & (SC_FL_WONT_READ|SC_FL_NEED_BUFF|SC_FL_NEED_ROOM))
|
||||||
ic->rex = TICK_ETERNITY;
|
sc_ep_reset_rex(sc);
|
||||||
else if (!tick_isset(ic->rex))
|
else if (!tick_isset(sc_ep_rex(sc)))
|
||||||
ic->rex = tick_add_ifset(now_ms, sc->rto);
|
sc_ep_set_rex(sc, sc->rto);
|
||||||
|
|
||||||
sc_chk_rcv(sc);
|
sc_chk_rcv(sc);
|
||||||
}
|
}
|
||||||
@ -1060,7 +1059,6 @@ void sc_update_rx(struct stconn *sc)
|
|||||||
void sc_update_tx(struct stconn *sc)
|
void sc_update_tx(struct stconn *sc)
|
||||||
{
|
{
|
||||||
struct channel *oc = sc_oc(sc);
|
struct channel *oc = sc_oc(sc);
|
||||||
struct channel *ic = sc_ic(sc);
|
|
||||||
|
|
||||||
if (oc->flags & CF_SHUTW)
|
if (oc->flags & CF_SHUTW)
|
||||||
return;
|
return;
|
||||||
@ -1071,7 +1069,7 @@ void sc_update_tx(struct stconn *sc)
|
|||||||
if (!sc_ep_test(sc, SE_FL_WAIT_DATA)) {
|
if (!sc_ep_test(sc, SE_FL_WAIT_DATA)) {
|
||||||
if ((oc->flags & CF_SHUTW_NOW) == 0)
|
if ((oc->flags & CF_SHUTW_NOW) == 0)
|
||||||
sc_ep_set(sc, SE_FL_WAIT_DATA);
|
sc_ep_set(sc, SE_FL_WAIT_DATA);
|
||||||
oc->wex = TICK_ETERNITY;
|
sc_ep_reset_wex(sc);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1082,16 +1080,16 @@ void sc_update_tx(struct stconn *sc)
|
|||||||
* have updated it if there has been a completed I/O.
|
* have updated it if there has been a completed I/O.
|
||||||
*/
|
*/
|
||||||
sc_ep_clr(sc, SE_FL_WAIT_DATA);
|
sc_ep_clr(sc, SE_FL_WAIT_DATA);
|
||||||
if (!tick_isset(oc->wex)) {
|
if (!tick_isset(sc_ep_wex(sc))) {
|
||||||
oc->wex = tick_add_ifset(now_ms, sc->wto);
|
sc_ep_set_wex(sc, sc->wto);
|
||||||
if (tick_isset(ic->rex) && !(sc->flags & SC_FL_INDEP_STR)) {
|
if (tick_isset(sc_ep_rex(sc)) && !(sc->flags & SC_FL_INDEP_STR)) {
|
||||||
/* Note: depending on the protocol, we don't know if we're waiting
|
/* Note: depending on the protocol, we don't know if we're waiting
|
||||||
* for incoming data or not. So in order to prevent the socket from
|
* for incoming data or not. So in order to prevent the socket from
|
||||||
* expiring read timeouts during writes, we refresh the read timeout,
|
* expiring read timeouts during writes, we refresh the read timeout,
|
||||||
* except if it was already infinite or if we have explicitly setup
|
* except if it was already infinite or if we have explicitly setup
|
||||||
* independent streams.
|
* independent streams.
|
||||||
*/
|
*/
|
||||||
ic->rex = tick_add_ifset(now_ms, sc->rto);
|
sc_ep_set_rex(sc, sc->rto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1120,7 +1118,7 @@ static void sc_notify(struct stconn *sc)
|
|||||||
if (((oc->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW) &&
|
if (((oc->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW) &&
|
||||||
(sc->state == SC_ST_EST) && (!conn || !(conn->flags & (CO_FL_WAIT_XPRT | CO_FL_EARLY_SSL_HS))))
|
(sc->state == SC_ST_EST) && (!conn || !(conn->flags & (CO_FL_WAIT_XPRT | CO_FL_EARLY_SSL_HS))))
|
||||||
sc_shutw(sc);
|
sc_shutw(sc);
|
||||||
oc->wex = TICK_ETERNITY;
|
sc_ep_reset_wex(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* indicate that we may be waiting for data from the output channel or
|
/* indicate that we may be waiting for data from the output channel or
|
||||||
@ -1135,12 +1133,12 @@ static void sc_notify(struct stconn *sc)
|
|||||||
if (oc->flags & (CF_WRITE_EVENT)) {
|
if (oc->flags & (CF_WRITE_EVENT)) {
|
||||||
if (sc_ep_test(sc, SE_FL_ERR_PENDING|SE_FL_ERROR) &&
|
if (sc_ep_test(sc, SE_FL_ERR_PENDING|SE_FL_ERROR) &&
|
||||||
!channel_is_empty(oc))
|
!channel_is_empty(oc))
|
||||||
if (tick_isset(oc->wex))
|
if (tick_isset(sc_ep_wex(sc)))
|
||||||
oc->wex = tick_add_ifset(now_ms, sc->wto);
|
sc_ep_set_wex(sc, sc->wto);
|
||||||
|
|
||||||
if (!(sc->flags & SC_FL_INDEP_STR))
|
if (!(sc->flags & SC_FL_INDEP_STR))
|
||||||
if (tick_isset(ic->rex))
|
if (tick_isset(sc_ep_rex(sc)))
|
||||||
ic->rex = tick_add_ifset(now_ms, sc->rto);
|
sc_ep_set_rex(sc, sc->rto);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oc->flags & CF_DONT_READ)
|
if (oc->flags & CF_DONT_READ)
|
||||||
@ -1190,12 +1188,12 @@ static void sc_notify(struct stconn *sc)
|
|||||||
|
|
||||||
if (ic->flags & (CF_EOI|CF_SHUTR) || sc_ep_test(sc, SE_FL_APPLET_NEED_CONN) ||
|
if (ic->flags & (CF_EOI|CF_SHUTR) || sc_ep_test(sc, SE_FL_APPLET_NEED_CONN) ||
|
||||||
(sc->flags & (SC_FL_WONT_READ|SC_FL_NEED_BUFF|SC_FL_NEED_ROOM))) {
|
(sc->flags & (SC_FL_WONT_READ|SC_FL_NEED_BUFF|SC_FL_NEED_ROOM))) {
|
||||||
ic->rex = TICK_ETERNITY;
|
sc_ep_reset_rex(sc);
|
||||||
}
|
}
|
||||||
else if ((ic->flags & (CF_SHUTR|CF_READ_EVENT)) == CF_READ_EVENT) {
|
else if ((ic->flags & (CF_SHUTR|CF_READ_EVENT)) == CF_READ_EVENT) {
|
||||||
/* we must re-enable reading if sc_chk_snd() has freed some space */
|
/* we must re-enable reading if sc_chk_snd() has freed some space */
|
||||||
if (tick_isset(ic->rex))
|
if (tick_isset(sc_ep_rex(sc)))
|
||||||
ic->rex = tick_add_ifset(now_ms, sc->rto);
|
sc_ep_set_rex(sc, sc->rto);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wake the task up only when needed */
|
/* wake the task up only when needed */
|
||||||
@ -1223,8 +1221,8 @@ static void sc_notify(struct stconn *sc)
|
|||||||
else {
|
else {
|
||||||
/* Update expiration date for the task and requeue it */
|
/* Update expiration date for the task and requeue it */
|
||||||
task->expire = tick_first((tick_is_expired(task->expire, now_ms) ? 0 : task->expire),
|
task->expire = tick_first((tick_is_expired(task->expire, now_ms) ? 0 : task->expire),
|
||||||
tick_first(tick_first(ic->rex, ic->wex),
|
tick_first(tick_first(sc_ep_rex(sc), sc_ep_wex(sc)),
|
||||||
tick_first(oc->rex, oc->wex)));
|
tick_first(sc_ep_rex(sco), sc_ep_wex(sco))));
|
||||||
|
|
||||||
task->expire = tick_first(task->expire, ic->analyse_exp);
|
task->expire = tick_first(task->expire, ic->analyse_exp);
|
||||||
task->expire = tick_first(task->expire, oc->analyse_exp);
|
task->expire = tick_first(task->expire, oc->analyse_exp);
|
||||||
@ -1251,7 +1249,7 @@ static void sc_conn_read0(struct stconn *sc)
|
|||||||
if (ic->flags & CF_SHUTR)
|
if (ic->flags & CF_SHUTR)
|
||||||
return;
|
return;
|
||||||
ic->flags |= CF_SHUTR;
|
ic->flags |= CF_SHUTR;
|
||||||
ic->rex = TICK_ETERNITY;
|
sc_ep_reset_rex(sc);
|
||||||
|
|
||||||
if (!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
|
if (!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
|
||||||
return;
|
return;
|
||||||
@ -1275,7 +1273,7 @@ static void sc_conn_read0(struct stconn *sc)
|
|||||||
|
|
||||||
oc->flags &= ~CF_SHUTW_NOW;
|
oc->flags &= ~CF_SHUTW_NOW;
|
||||||
oc->flags |= CF_SHUTW;
|
oc->flags |= CF_SHUTW;
|
||||||
oc->wex = TICK_ETERNITY;
|
sc_ep_reset_wex(sc);
|
||||||
|
|
||||||
sc->state = SC_ST_DIS;
|
sc->state = SC_ST_DIS;
|
||||||
if (sc->flags & SC_FL_ISBACK)
|
if (sc->flags & SC_FL_ISBACK)
|
||||||
|
140
src/stream.c
140
src/stream.c
@ -206,10 +206,11 @@ static void strm_trace(enum trace_level level, uint64_t mask, const struct trace
|
|||||||
task, s, s->flags, s->conn_err_type, txn->flags, txn->req.flags, txn->rsp.flags, txn->status);
|
task, s, s->flags, s->conn_err_type, txn->flags, txn->req.flags, txn->rsp.flags, txn->status);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
chunk_appendf(&trace_buf, " - t=%p s=(%p,0x%08x,0x%x) scf=(%p,%d,0x%08x,0x%x) scb=(%p,%d,0x%08x,0x%x) retries=%d",
|
chunk_appendf(&trace_buf, " - t=%p s=(%p,0x%08x,0x%x) scf=(%p,%d,0x%08x,0x%x) scb=(%p,%d,0x%08x,0x%x) scf.exp(r,w)=(%u,%u) scb.exp(r,w)=(%u,%u) retries=%d",
|
||||||
task, s, s->flags, s->conn_err_type,
|
task, s, s->flags, s->conn_err_type,
|
||||||
s->scf, s->scf->state, s->scf->flags, s->scf->sedesc->flags,
|
s->scf, s->scf->state, s->scf->flags, s->scf->sedesc->flags,
|
||||||
s->scb, s->scb->state, s->scb->flags, s->scb->sedesc->flags,
|
s->scb, s->scb->state, s->scb->flags, s->scb->sedesc->flags,
|
||||||
|
sc_ep_rex(s->scf), sc_ep_wex(s->scf), sc_ep_rex(s->scb), sc_ep_wex(s->scb),
|
||||||
s->conn_retries);
|
s->conn_retries);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,17 +220,17 @@ static void strm_trace(enum trace_level level, uint64_t mask, const struct trace
|
|||||||
|
|
||||||
/* If txn defined, don't display all channel info */
|
/* If txn defined, don't display all channel info */
|
||||||
if (src->verbosity == STRM_VERB_SIMPLE || txn) {
|
if (src->verbosity == STRM_VERB_SIMPLE || txn) {
|
||||||
chunk_appendf(&trace_buf, " req=(%p .fl=0x%08x .exp(r,w,a)=(%u,%u,%u))",
|
chunk_appendf(&trace_buf, " req=(%p .fl=0x%08x .exp=,%u)",
|
||||||
req, req->flags, req->rex, req->wex, req->analyse_exp);
|
req, req->flags, req->analyse_exp);
|
||||||
chunk_appendf(&trace_buf, " res=(%p .fl=0x%08x .exp(r,w,a)=(%u,%u,%u))",
|
chunk_appendf(&trace_buf, " res=(%p .fl=0x%08x .exp=%u)",
|
||||||
res, res->flags, res->rex, res->wex, res->analyse_exp);
|
res, res->flags, res->analyse_exp);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
chunk_appendf(&trace_buf, " req=(%p .fl=0x%08x .ana=0x%08x .exp(r,w,a)=(%u,%u,%u) .o=%lu .tot=%llu .to_fwd=%u)",
|
chunk_appendf(&trace_buf, " req=(%p .fl=0x%08x .ana=0x%08x .exp=%u .o=%lu .tot=%llu .to_fwd=%u)",
|
||||||
req, req->flags, req->analysers, req->rex, req->wex, req->analyse_exp,
|
req, req->flags, req->analysers, req->analyse_exp,
|
||||||
(long)req->output, req->total, req->to_forward);
|
(long)req->output, req->total, req->to_forward);
|
||||||
chunk_appendf(&trace_buf, " res=(%p .fl=0x%08x .ana=0x%08x .exp(r,w,a)=(%u,%u,%u) .o=%lu .tot=%llu .to_fwd=%u)",
|
chunk_appendf(&trace_buf, " res=(%p .fl=0x%08x .ana=0x%08x .exp=%u .o=%lu .tot=%llu .to_fwd=%u)",
|
||||||
res, res->flags, res->analysers, res->rex, res->wex, res->analyse_exp,
|
res, res->flags, res->analysers, res->analyse_exp,
|
||||||
(long)res->output, res->total, res->to_forward);
|
(long)res->output, res->total, res->to_forward);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,8 +520,6 @@ struct stream *stream_new(struct session *sess, struct stconn *sc, struct buffer
|
|||||||
|
|
||||||
s->scf->rto = sess->fe->timeout.client;
|
s->scf->rto = sess->fe->timeout.client;
|
||||||
s->scf->wto = sess->fe->timeout.client;
|
s->scf->wto = sess->fe->timeout.client;
|
||||||
s->req.rex = TICK_ETERNITY;
|
|
||||||
s->req.wex = TICK_ETERNITY;
|
|
||||||
s->req.analyse_exp = TICK_ETERNITY;
|
s->req.analyse_exp = TICK_ETERNITY;
|
||||||
|
|
||||||
channel_init(&s->res);
|
channel_init(&s->res);
|
||||||
@ -534,8 +533,6 @@ struct stream *stream_new(struct session *sess, struct stconn *sc, struct buffer
|
|||||||
|
|
||||||
s->scb->wto = TICK_ETERNITY;
|
s->scb->wto = TICK_ETERNITY;
|
||||||
s->scb->rto = TICK_ETERNITY;
|
s->scb->rto = TICK_ETERNITY;
|
||||||
s->res.rex = TICK_ETERNITY;
|
|
||||||
s->res.wex = TICK_ETERNITY;
|
|
||||||
s->res.analyse_exp = TICK_ETERNITY;
|
s->res.analyse_exp = TICK_ETERNITY;
|
||||||
|
|
||||||
s->txn = NULL;
|
s->txn = NULL;
|
||||||
@ -854,7 +851,7 @@ void stream_retnclose(struct stream *s, const struct buffer *msg)
|
|||||||
if (likely(msg && msg->data))
|
if (likely(msg && msg->data))
|
||||||
co_inject(oc, msg->area, msg->data);
|
co_inject(oc, msg->area, msg->data);
|
||||||
|
|
||||||
oc->wex = tick_add_ifset(now_ms, s->scf->wto);
|
sc_ep_set_wex(s->scf, s->scf->wto);
|
||||||
channel_auto_read(oc);
|
channel_auto_read(oc);
|
||||||
channel_auto_close(oc);
|
channel_auto_close(oc);
|
||||||
channel_shutr_now(oc);
|
channel_shutr_now(oc);
|
||||||
@ -950,7 +947,7 @@ static void back_establish(struct stream *s)
|
|||||||
*/
|
*/
|
||||||
sc_chk_rcv(s->scb);
|
sc_chk_rcv(s->scb);
|
||||||
}
|
}
|
||||||
req->wex = TICK_ETERNITY;
|
sc_ep_reset_wex(s->scf);
|
||||||
/* If we managed to get the whole response, and we don't have anything
|
/* If we managed to get the whole response, and we don't have anything
|
||||||
* left to send, or can't, switch to SC_ST_DIS now. */
|
* left to send, or can't, switch to SC_ST_DIS now. */
|
||||||
if (rep->flags & (CF_SHUTR | CF_SHUTW)) {
|
if (rep->flags & (CF_SHUTR | CF_SHUTW)) {
|
||||||
@ -2434,10 +2431,10 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
|||||||
if ((res->flags & CF_SHUTW) && tick_isset(sess->fe->timeout.clientfin))
|
if ((res->flags & CF_SHUTW) && tick_isset(sess->fe->timeout.clientfin))
|
||||||
scf->rto = sess->fe->timeout.clientfin;
|
scf->rto = sess->fe->timeout.clientfin;
|
||||||
|
|
||||||
req->rex = tick_add(now_ms, scf->rto);
|
sc_ep_set_rex(scf, scf->rto);
|
||||||
req->wex = tick_add(now_ms, scb->wto);
|
sc_ep_set_wex(scf, scb->wto);
|
||||||
res->rex = tick_add(now_ms, scb->rto);
|
sc_ep_set_rex(scb, scb->rto);
|
||||||
res->wex = tick_add(now_ms, scf->wto);
|
sc_ep_set_wex(scb, scf->wto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2526,8 +2523,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
|||||||
update_exp_and_leave:
|
update_exp_and_leave:
|
||||||
/* Note: please ensure that if you branch here you disable SC_FL_DONT_WAKE */
|
/* Note: please ensure that if you branch here you disable SC_FL_DONT_WAKE */
|
||||||
t->expire = tick_first((tick_is_expired(t->expire, now_ms) ? 0 : t->expire),
|
t->expire = tick_first((tick_is_expired(t->expire, now_ms) ? 0 : t->expire),
|
||||||
tick_first(tick_first(req->rex, req->wex),
|
tick_first(tick_first(sc_ep_rex(scf), sc_ep_wex(scf)),
|
||||||
tick_first(res->rex, res->wex)));
|
tick_first(sc_ep_rex(scb), sc_ep_wex(scb))));
|
||||||
if (!req->analysers)
|
if (!req->analysers)
|
||||||
req->analyse_exp = TICK_ETERNITY;
|
req->analyse_exp = TICK_ETERNITY;
|
||||||
|
|
||||||
@ -3353,10 +3350,14 @@ static int stats_dump_full_strm_to_buffer(struct stconn *sc, struct stream *strm
|
|||||||
strm->txn->req.flags, strm->txn->rsp.flags);
|
strm->txn->req.flags, strm->txn->rsp.flags);
|
||||||
|
|
||||||
scf = strm->scf;
|
scf = strm->scf;
|
||||||
chunk_appendf(&trash, " scf=%p flags=0x%08x state=%s endp=%s,%p,0x%08x sub=%d\n",
|
chunk_appendf(&trash, " scf=%p flags=0x%08x state=%s endp=%s,%p,0x%08x sub=%d",
|
||||||
scf, scf->flags, sc_state_str(scf->state),
|
scf, scf->flags, sc_state_str(scf->state),
|
||||||
(sc_ep_test(scf, SE_FL_T_MUX) ? "CONN" : (sc_ep_test(scf, SE_FL_T_APPLET) ? "APPCTX" : "NONE")),
|
(sc_ep_test(scf, SE_FL_T_MUX) ? "CONN" : (sc_ep_test(scf, SE_FL_T_APPLET) ? "APPCTX" : "NONE")),
|
||||||
scf->sedesc->se, sc_ep_get(scf), scf->wait_event.events);
|
scf->sedesc->se, sc_ep_get(scf), scf->wait_event.events);
|
||||||
|
chunk_appendf(&trash, " rex=%s",
|
||||||
|
sc_ep_rex(scf) ? human_time(TICKS_TO_MS(sc_ep_rex(scf) - now_ms), TICKS_TO_MS(1000)) : "<NEVER>");
|
||||||
|
chunk_appendf(&trash, " wex=%s\n",
|
||||||
|
sc_ep_wex(scf) ? human_time(TICKS_TO_MS(sc_ep_wex(scf) - now_ms), TICKS_TO_MS(1000)) : "<NEVER>");
|
||||||
|
|
||||||
if ((conn = sc_conn(scf)) != NULL) {
|
if ((conn = sc_conn(scf)) != NULL) {
|
||||||
if (conn->mux && conn->mux->show_sd) {
|
if (conn->mux && conn->mux->show_sd) {
|
||||||
@ -3395,10 +3396,14 @@ static int stats_dump_full_strm_to_buffer(struct stconn *sc, struct stream *strm
|
|||||||
}
|
}
|
||||||
|
|
||||||
scb = strm->scb;
|
scb = strm->scb;
|
||||||
chunk_appendf(&trash, " scb=%p flags=0x%08x state=%s endp=%s,%p,0x%08x sub=%d\n",
|
chunk_appendf(&trash, " scb=%p flags=0x%08x state=%s endp=%s,%p,0x%08x sub=%d",
|
||||||
scb, scb->flags, sc_state_str(scb->state),
|
scb, scb->flags, sc_state_str(scb->state),
|
||||||
(sc_ep_test(scb, SE_FL_T_MUX) ? "CONN" : (sc_ep_test(scb, SE_FL_T_APPLET) ? "APPCTX" : "NONE")),
|
(sc_ep_test(scb, SE_FL_T_MUX) ? "CONN" : (sc_ep_test(scb, SE_FL_T_APPLET) ? "APPCTX" : "NONE")),
|
||||||
scb->sedesc->se, sc_ep_get(scb), scb->wait_event.events);
|
scb->sedesc->se, sc_ep_get(scb), scb->wait_event.events);
|
||||||
|
chunk_appendf(&trash, " rex=%s",
|
||||||
|
sc_ep_rex(scb) ? human_time(TICKS_TO_MS(sc_ep_rex(scb) - now_ms), TICKS_TO_MS(1000)) : "<NEVER>");
|
||||||
|
chunk_appendf(&trash, " wex=%s\n",
|
||||||
|
sc_ep_wex(scb) ? human_time(TICKS_TO_MS(sc_ep_wex(scb) - now_ms), TICKS_TO_MS(1000)) : "<NEVER>");
|
||||||
|
|
||||||
if ((conn = sc_conn(scb)) != NULL) {
|
if ((conn = sc_conn(scb)) != NULL) {
|
||||||
if (conn->mux && conn->mux->show_sd) {
|
if (conn->mux && conn->mux->show_sd) {
|
||||||
@ -3438,29 +3443,16 @@ static int stats_dump_full_strm_to_buffer(struct stconn *sc, struct stream *strm
|
|||||||
|
|
||||||
chunk_appendf(&trash,
|
chunk_appendf(&trash,
|
||||||
" req=%p (f=0x%06x an=0x%x pipe=%d tofwd=%d total=%lld)\n"
|
" req=%p (f=0x%06x an=0x%x pipe=%d tofwd=%d total=%lld)\n"
|
||||||
" an_exp=%s",
|
" an_exp=%s buf=%p data=%p o=%u p=%u i=%u size=%u\n",
|
||||||
&strm->req,
|
&strm->req,
|
||||||
strm->req.flags, strm->req.analysers,
|
strm->req.flags, strm->req.analysers,
|
||||||
strm->req.pipe ? strm->req.pipe->data : 0,
|
strm->req.pipe ? strm->req.pipe->data : 0,
|
||||||
strm->req.to_forward, strm->req.total,
|
strm->req.to_forward, strm->req.total,
|
||||||
strm->req.analyse_exp ?
|
strm->req.analyse_exp ?
|
||||||
human_time(TICKS_TO_MS(strm->req.analyse_exp - now_ms),
|
human_time(TICKS_TO_MS(strm->req.analyse_exp - now_ms),
|
||||||
TICKS_TO_MS(1000)) : "<NEVER>");
|
|
||||||
|
|
||||||
chunk_appendf(&trash,
|
|
||||||
" rex=%s",
|
|
||||||
strm->req.rex ?
|
|
||||||
human_time(TICKS_TO_MS(strm->req.rex - now_ms),
|
|
||||||
TICKS_TO_MS(1000)) : "<NEVER>");
|
|
||||||
|
|
||||||
chunk_appendf(&trash,
|
|
||||||
" wex=%s\n"
|
|
||||||
" buf=%p data=%p o=%u p=%u i=%u size=%u\n",
|
|
||||||
strm->req.wex ?
|
|
||||||
human_time(TICKS_TO_MS(strm->req.wex - now_ms),
|
|
||||||
TICKS_TO_MS(1000)) : "<NEVER>",
|
TICKS_TO_MS(1000)) : "<NEVER>",
|
||||||
&strm->req.buf,
|
&strm->req.buf,
|
||||||
b_orig(&strm->req.buf), (unsigned int)co_data(&strm->req),
|
b_orig(&strm->req.buf), (unsigned int)co_data(&strm->req),
|
||||||
(unsigned int)ci_head_ofs(&strm->req), (unsigned int)ci_data(&strm->req),
|
(unsigned int)ci_head_ofs(&strm->req), (unsigned int)ci_data(&strm->req),
|
||||||
(unsigned int)strm->req.buf.size);
|
(unsigned int)strm->req.buf.size);
|
||||||
|
|
||||||
@ -3482,26 +3474,13 @@ static int stats_dump_full_strm_to_buffer(struct stconn *sc, struct stream *strm
|
|||||||
|
|
||||||
chunk_appendf(&trash,
|
chunk_appendf(&trash,
|
||||||
" res=%p (f=0x%06x an=0x%x pipe=%d tofwd=%d total=%lld)\n"
|
" res=%p (f=0x%06x an=0x%x pipe=%d tofwd=%d total=%lld)\n"
|
||||||
" an_exp=%s",
|
" an_exp=%s buf=%p data=%p o=%u p=%u i=%u size=%u\n",
|
||||||
&strm->res,
|
&strm->res,
|
||||||
strm->res.flags, strm->res.analysers,
|
strm->res.flags, strm->res.analysers,
|
||||||
strm->res.pipe ? strm->res.pipe->data : 0,
|
strm->res.pipe ? strm->res.pipe->data : 0,
|
||||||
strm->res.to_forward, strm->res.total,
|
strm->res.to_forward, strm->res.total,
|
||||||
strm->res.analyse_exp ?
|
strm->res.analyse_exp ?
|
||||||
human_time(TICKS_TO_MS(strm->res.analyse_exp - now_ms),
|
human_time(TICKS_TO_MS(strm->res.analyse_exp - now_ms),
|
||||||
TICKS_TO_MS(1000)) : "<NEVER>");
|
|
||||||
|
|
||||||
chunk_appendf(&trash,
|
|
||||||
" rex=%s",
|
|
||||||
strm->res.rex ?
|
|
||||||
human_time(TICKS_TO_MS(strm->res.rex - now_ms),
|
|
||||||
TICKS_TO_MS(1000)) : "<NEVER>");
|
|
||||||
|
|
||||||
chunk_appendf(&trash,
|
|
||||||
" wex=%s\n"
|
|
||||||
" buf=%p data=%p o=%u p=%u i=%u size=%u\n",
|
|
||||||
strm->res.wex ?
|
|
||||||
human_time(TICKS_TO_MS(strm->res.wex - now_ms),
|
|
||||||
TICKS_TO_MS(1000)) : "<NEVER>",
|
TICKS_TO_MS(1000)) : "<NEVER>",
|
||||||
&strm->res.buf,
|
&strm->res.buf,
|
||||||
b_orig(&strm->res.buf), (unsigned int)co_data(&strm->res),
|
b_orig(&strm->res.buf), (unsigned int)co_data(&strm->res),
|
||||||
@ -3692,19 +3671,10 @@ static int cli_io_handler_dump_sess(struct appctx *appctx)
|
|||||||
(unsigned long long)curr_strm->cpu_time, (unsigned long long)curr_strm->lat_time);
|
(unsigned long long)curr_strm->cpu_time, (unsigned long long)curr_strm->lat_time);
|
||||||
|
|
||||||
chunk_appendf(&trash,
|
chunk_appendf(&trash,
|
||||||
" rq[f=%06xh,i=%u,an=%02xh,rx=%s",
|
" rq[f=%06xh,i=%u,an=%02xh",
|
||||||
curr_strm->req.flags,
|
curr_strm->req.flags,
|
||||||
(unsigned int)ci_data(&curr_strm->req),
|
(unsigned int)ci_data(&curr_strm->req),
|
||||||
curr_strm->req.analysers,
|
curr_strm->req.analysers);
|
||||||
curr_strm->req.rex ?
|
|
||||||
human_time(TICKS_TO_MS(curr_strm->req.rex - now_ms),
|
|
||||||
TICKS_TO_MS(1000)) : "");
|
|
||||||
|
|
||||||
chunk_appendf(&trash,
|
|
||||||
",wx=%s",
|
|
||||||
curr_strm->req.wex ?
|
|
||||||
human_time(TICKS_TO_MS(curr_strm->req.wex - now_ms),
|
|
||||||
TICKS_TO_MS(1000)) : "");
|
|
||||||
|
|
||||||
chunk_appendf(&trash,
|
chunk_appendf(&trash,
|
||||||
",ax=%s]",
|
",ax=%s]",
|
||||||
@ -3713,20 +3683,10 @@ static int cli_io_handler_dump_sess(struct appctx *appctx)
|
|||||||
TICKS_TO_MS(1000)) : "");
|
TICKS_TO_MS(1000)) : "");
|
||||||
|
|
||||||
chunk_appendf(&trash,
|
chunk_appendf(&trash,
|
||||||
" rp[f=%06xh,i=%u,an=%02xh,rx=%s",
|
" rp[f=%06xh,i=%u,an=%02xh",
|
||||||
curr_strm->res.flags,
|
curr_strm->res.flags,
|
||||||
(unsigned int)ci_data(&curr_strm->res),
|
(unsigned int)ci_data(&curr_strm->res),
|
||||||
curr_strm->res.analysers,
|
curr_strm->res.analysers);
|
||||||
curr_strm->res.rex ?
|
|
||||||
human_time(TICKS_TO_MS(curr_strm->res.rex - now_ms),
|
|
||||||
TICKS_TO_MS(1000)) : "");
|
|
||||||
|
|
||||||
chunk_appendf(&trash,
|
|
||||||
",wx=%s",
|
|
||||||
curr_strm->res.wex ?
|
|
||||||
human_time(TICKS_TO_MS(curr_strm->res.wex - now_ms),
|
|
||||||
TICKS_TO_MS(1000)) : "");
|
|
||||||
|
|
||||||
chunk_appendf(&trash,
|
chunk_appendf(&trash,
|
||||||
",ax=%s]",
|
",ax=%s]",
|
||||||
curr_strm->res.analyse_exp ?
|
curr_strm->res.analyse_exp ?
|
||||||
@ -3734,18 +3694,28 @@ static int cli_io_handler_dump_sess(struct appctx *appctx)
|
|||||||
TICKS_TO_MS(1000)) : "");
|
TICKS_TO_MS(1000)) : "");
|
||||||
|
|
||||||
conn = sc_conn(curr_strm->scf);
|
conn = sc_conn(curr_strm->scf);
|
||||||
chunk_appendf(&trash,
|
chunk_appendf(&trash," scf=[%d,%1xh,fd=%d",
|
||||||
" scf=[%d,%1xh,fd=%d]",
|
curr_strm->scf->state, curr_strm->scf->flags, conn_fd(conn));
|
||||||
curr_strm->scf->state,
|
chunk_appendf(&trash, ",rex=%s",
|
||||||
curr_strm->scf->flags,
|
sc_ep_rex(curr_strm->scf) ?
|
||||||
conn_fd(conn));
|
human_time(TICKS_TO_MS(sc_ep_rex(curr_strm->scf) - now_ms),
|
||||||
|
TICKS_TO_MS(1000)) : "");
|
||||||
|
chunk_appendf(&trash,",wex=%s]",
|
||||||
|
sc_ep_wex(curr_strm->scf) ?
|
||||||
|
human_time(TICKS_TO_MS(sc_ep_wex(curr_strm->scf) - now_ms),
|
||||||
|
TICKS_TO_MS(1000)) : "");
|
||||||
|
|
||||||
conn = sc_conn(curr_strm->scb);
|
conn = sc_conn(curr_strm->scb);
|
||||||
chunk_appendf(&trash,
|
chunk_appendf(&trash, " scb=[%d,%1xh,fd=%d",
|
||||||
" scb=[%d,%1xh,fd=%d]",
|
curr_strm->scb->state, curr_strm->scb->flags, conn_fd(conn));
|
||||||
curr_strm->scb->state,
|
chunk_appendf(&trash, ",rex=%s",
|
||||||
curr_strm->scb->flags,
|
sc_ep_rex(curr_strm->scb) ?
|
||||||
conn_fd(conn));
|
human_time(TICKS_TO_MS(sc_ep_rex(curr_strm->scb) - now_ms),
|
||||||
|
TICKS_TO_MS(1000)) : "");
|
||||||
|
chunk_appendf(&trash, ",wex=%s]",
|
||||||
|
sc_ep_wex(curr_strm->scb) ?
|
||||||
|
human_time(TICKS_TO_MS(sc_ep_wex(curr_strm->scb) - now_ms),
|
||||||
|
TICKS_TO_MS(1000)) : "");
|
||||||
|
|
||||||
chunk_appendf(&trash,
|
chunk_appendf(&trash,
|
||||||
" exp=%s rc=%d c_exp=%s",
|
" exp=%s rc=%d c_exp=%s",
|
||||||
|
Loading…
Reference in New Issue
Block a user