mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
CLEANUP: stconn: Remove old read and write expiration dates
Old read and write expiration dates are no longer used. Thus we can safely remove them.
This commit is contained in:
parent
b08c5259eb
commit
15315d6c0a
@ -201,8 +201,6 @@ struct stconn;
|
|||||||
* <sc> is the stream connector we're attached to, or NULL
|
* <sc> is the stream connector we're attached to, or NULL
|
||||||
* <lra> is the last read activity
|
* <lra> is the last read activity
|
||||||
* <fsb> is the first send blocked
|
* <fsb> is the first send blocked
|
||||||
* <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_*
|
||||||
*
|
*
|
||||||
* <lra> should be updated when a read activity is detected. It can be a
|
* <lra> should be updated when a read activity is detected. It can be a
|
||||||
@ -219,8 +217,6 @@ struct sedesc {
|
|||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
unsigned int lra;
|
unsigned int lra;
|
||||||
unsigned int fsb;
|
unsigned int fsb;
|
||||||
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
|
||||||
|
@ -187,37 +187,6 @@ static forceinline int sc_ep_snd_ex(const struct stconn *sc)
|
|||||||
: TICK_ETERNITY);
|
: TICK_ETERNITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -2827,13 +2827,9 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
s->scf->ioto = strm_fe(s)->timeout.client;
|
s->scf->ioto = strm_fe(s)->timeout.client;
|
||||||
s->scb->ioto = TICK_ETERNITY;
|
s->scb->ioto = TICK_ETERNITY;
|
||||||
|
|
||||||
sc_ep_reset_rex(s->scf);
|
|
||||||
sc_ep_reset_wex(s->scf);
|
|
||||||
s->req.analyse_exp = TICK_ETERNITY;
|
s->req.analyse_exp = 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;
|
||||||
|
|
||||||
/* we're removing the analysers, we MUST re-enable events detection.
|
/* we're removing the analysers, we MUST re-enable events detection.
|
||||||
|
10
src/debug.c
10
src/debug.c
@ -761,7 +761,7 @@ static int debug_parse_cli_stream(char **args, char *payload, struct appctx *app
|
|||||||
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 |\n"
|
" <obj> = {strm | strm.f | strm.x |\n"
|
||||||
" scf.s | scf.r | scf.w | scb.s | scb.r | scb.w |\n"
|
" scf.s | scb.s |\n"
|
||||||
" txn.f | req.f | res.f}\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"
|
||||||
@ -790,16 +790,8 @@ static int debug_parse_cli_stream(char **args, char *payload, struct appctx *app
|
|||||||
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("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);
|
||||||
|
@ -834,10 +834,6 @@ static int dns_session_init(struct appctx *appctx)
|
|||||||
s->uniq_id = 0;
|
s->uniq_id = 0;
|
||||||
|
|
||||||
s->res.flags |= CF_READ_DONTWAIT;
|
s->res.flags |= CF_READ_DONTWAIT;
|
||||||
/* set rex to eternity to not expire on idle recv:
|
|
||||||
* We are using a syslog server.
|
|
||||||
*/
|
|
||||||
sc_ep_reset_rex(s->scb);
|
|
||||||
applet_expect_no_data(appctx);
|
applet_expect_no_data(appctx);
|
||||||
ds->appctx = appctx;
|
ds->appctx = appctx;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2523,9 +2523,6 @@ static int hlua_socket_write_yield(struct lua_State *L,int status, lua_KContext
|
|||||||
/* update buffers. */
|
/* update buffers. */
|
||||||
appctx_wakeup(appctx);
|
appctx_wakeup(appctx);
|
||||||
|
|
||||||
sc_ep_reset_rex(s->scf);;
|
|
||||||
sc_ep_reset_wex(s->scb);
|
|
||||||
|
|
||||||
/* Update length sent. */
|
/* Update length sent. */
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
lua_pushinteger(L, sent + len);
|
lua_pushinteger(L, sent + len);
|
||||||
@ -3017,10 +3014,6 @@ __LJMP static int hlua_socket_settimeout(struct lua_State *L)
|
|||||||
s->sess->fe->timeout.connect = tmout;
|
s->sess->fe->timeout.connect = tmout;
|
||||||
s->scf->ioto = tmout;
|
s->scf->ioto = tmout;
|
||||||
s->scb->ioto = tmout;
|
s->scb->ioto = tmout;
|
||||||
sc_ep_set_rex(s->scf, tmout);
|
|
||||||
sc_ep_set_wex(s->scf, tmout);
|
|
||||||
sc_ep_set_rex(s->scb, 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);
|
||||||
@ -8083,7 +8076,6 @@ __LJMP static int hlua_txn_done(lua_State *L)
|
|||||||
channel_auto_close(req);
|
channel_auto_close(req);
|
||||||
channel_erase(req);
|
channel_erase(req);
|
||||||
|
|
||||||
sc_ep_set_wex(s->scb, s->scf->ioto);
|
|
||||||
channel_auto_read(res);
|
channel_auto_read(res);
|
||||||
channel_auto_close(res);
|
channel_auto_close(res);
|
||||||
channel_shutr_now(res);
|
channel_shutr_now(res);
|
||||||
|
@ -4438,7 +4438,6 @@ 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));
|
||||||
|
|
||||||
sc_ep_set_wex(s->scb, s->scf->ioto);
|
|
||||||
channel_auto_read(res);
|
channel_auto_read(res);
|
||||||
channel_auto_close(res);
|
channel_auto_close(res);
|
||||||
channel_shutr_now(res);
|
channel_shutr_now(res);
|
||||||
@ -4492,8 +4491,6 @@ void http_reply_and_close(struct stream *s, short status, struct http_reply *msg
|
|||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
sc_ep_set_wex(s->scb, s->scf->ioto);
|
|
||||||
|
|
||||||
/* 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;
|
||||||
s->req.analyse_exp = TICK_ETERNITY;
|
s->req.analyse_exp = TICK_ETERNITY;
|
||||||
|
16
src/sink.c
16
src/sink.c
@ -322,12 +322,6 @@ static void sink_forward_io_handler(struct appctx *appctx)
|
|||||||
if (unlikely(stopping))
|
if (unlikely(stopping))
|
||||||
goto close;
|
goto close;
|
||||||
|
|
||||||
/* for rex because it seems reset to timeout
|
|
||||||
* and we don't want expire on this case
|
|
||||||
* with a syslog server
|
|
||||||
*/
|
|
||||||
sc_ep_reset_rex(sc_opposite(sc));
|
|
||||||
|
|
||||||
if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
|
if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
|
||||||
goto close;
|
goto close;
|
||||||
|
|
||||||
@ -467,12 +461,6 @@ static void sink_forward_oc_io_handler(struct appctx *appctx)
|
|||||||
if (unlikely(stopping))
|
if (unlikely(stopping))
|
||||||
goto close;
|
goto close;
|
||||||
|
|
||||||
/* for rex because it seems reset to timeout
|
|
||||||
* and we don't want expire on this case
|
|
||||||
* with a syslog server
|
|
||||||
*/
|
|
||||||
sc_ep_reset_rex(sc_opposite(sc));
|
|
||||||
|
|
||||||
/* an error was detected */
|
/* an error was detected */
|
||||||
if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
|
if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
|
||||||
goto close;
|
goto close;
|
||||||
@ -626,10 +614,6 @@ static int sink_forward_session_init(struct appctx *appctx)
|
|||||||
s->uniq_id = 0;
|
s->uniq_id = 0;
|
||||||
|
|
||||||
s->res.flags |= CF_READ_DONTWAIT;
|
s->res.flags |= CF_READ_DONTWAIT;
|
||||||
/* Set rex to eternity to not expire on idle recv:
|
|
||||||
* We are using a syslog server.
|
|
||||||
*/
|
|
||||||
sc_ep_reset_rex(s->scb);
|
|
||||||
applet_expect_no_data(appctx);
|
applet_expect_no_data(appctx);
|
||||||
sft->appctx = appctx;
|
sft->appctx = appctx;
|
||||||
|
|
||||||
|
98
src/stconn.c
98
src/stconn.c
@ -94,7 +94,6 @@ void sedesc_init(struct sedesc *sedesc)
|
|||||||
sedesc->sc = NULL;
|
sedesc->sc = NULL;
|
||||||
sedesc->lra = TICK_ETERNITY;
|
sedesc->lra = TICK_ETERNITY;
|
||||||
sedesc->fsb = TICK_ETERNITY;
|
sedesc->fsb = TICK_ETERNITY;
|
||||||
sedesc->rex = sedesc->wex = TICK_ETERNITY;
|
|
||||||
se_fl_setall(sedesc, SE_FL_NONE);
|
se_fl_setall(sedesc, SE_FL_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,7 +535,6 @@ static void sc_app_shutr(struct stconn *sc)
|
|||||||
|
|
||||||
ic->flags |= CF_SHUTR|CF_READ_EVENT;
|
ic->flags |= CF_SHUTR|CF_READ_EVENT;
|
||||||
sc_ep_report_read_activity(sc);
|
sc_ep_report_read_activity(sc);
|
||||||
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;
|
||||||
@ -570,12 +568,9 @@ static void sc_app_shutw(struct stconn *sc)
|
|||||||
if (oc->flags & CF_SHUTW)
|
if (oc->flags & CF_SHUTW)
|
||||||
return;
|
return;
|
||||||
oc->flags |= CF_SHUTW|CF_WRITE_EVENT;
|
oc->flags |= CF_SHUTW|CF_WRITE_EVENT;
|
||||||
sc_ep_reset_wex(sc);
|
|
||||||
|
|
||||||
if (tick_isset(sc->hcto)) {
|
if (tick_isset(sc->hcto))
|
||||||
sc->ioto = sc->hcto;
|
sc->ioto = sc->hcto;
|
||||||
sc_ep_set_rex(sc, sc->ioto);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (sc->state) {
|
switch (sc->state) {
|
||||||
case SC_ST_RDY:
|
case SC_ST_RDY:
|
||||||
@ -601,7 +596,6 @@ 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;
|
||||||
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;
|
||||||
}
|
}
|
||||||
@ -651,9 +645,6 @@ 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(sc_ep_wex(sc)))
|
|
||||||
sc_ep_set_wex(sc, sc->ioto);
|
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
@ -677,7 +668,6 @@ 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|CF_READ_EVENT;
|
ic->flags |= CF_SHUTR|CF_READ_EVENT;
|
||||||
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;
|
||||||
@ -711,12 +701,9 @@ 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|CF_WRITE_EVENT;
|
oc->flags |= CF_SHUTW|CF_WRITE_EVENT;
|
||||||
sc_ep_reset_wex(sc);
|
|
||||||
|
|
||||||
if (tick_isset(sc->hcto)) {
|
if (tick_isset(sc->hcto))
|
||||||
sc->ioto = sc->hcto;
|
sc->ioto = sc->hcto;
|
||||||
sc_ep_set_rex(sc, sc->ioto);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (sc->state) {
|
switch (sc->state) {
|
||||||
case SC_ST_RDY:
|
case SC_ST_RDY:
|
||||||
@ -767,7 +754,6 @@ 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;
|
||||||
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;
|
||||||
}
|
}
|
||||||
@ -839,33 +825,12 @@ 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);
|
||||||
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(sc_ep_wex(sc)))
|
|
||||||
sc_ep_set_wex(sc, sc->ioto);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (likely(oc->flags & CF_WRITE_EVENT)) {
|
|
||||||
/* update timeout if we have written something */
|
|
||||||
if (!(oc->flags & CF_SHUTW) && !channel_is_empty(oc))
|
|
||||||
sc_ep_set_wex(sc, sc->ioto);
|
|
||||||
|
|
||||||
if (tick_isset(sc_ep_rex(sc)) && !(sc->flags & SC_FL_INDEP_STR)) {
|
|
||||||
/* Note: to prevent the client from expiring read timeouts
|
|
||||||
* during writes, we refresh it. We only do this if the
|
|
||||||
* interface is not configured for "independent streams",
|
|
||||||
* because for some applications it's better not to do this,
|
|
||||||
* for instance when continuously exchanging small amounts
|
|
||||||
* of data which can full the socket buffers long before a
|
|
||||||
* write timeout is detected.
|
|
||||||
*/
|
|
||||||
sc_ep_set_rex(sc, sc->ioto);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* in case of special condition (error, shutdown, end of write...), we
|
/* in case of special condition (error, shutdown, end of write...), we
|
||||||
@ -899,7 +864,6 @@ 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|CF_READ_EVENT;
|
ic->flags |= CF_SHUTR|CF_READ_EVENT;
|
||||||
sc_ep_reset_rex(sc);
|
|
||||||
|
|
||||||
/* Note: on shutr, we don't call the applet */
|
/* Note: on shutr, we don't call the applet */
|
||||||
|
|
||||||
@ -934,12 +898,9 @@ 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|CF_WRITE_EVENT;
|
oc->flags |= CF_SHUTW|CF_WRITE_EVENT;
|
||||||
sc_ep_reset_wex(sc);
|
|
||||||
|
|
||||||
if (tick_isset(sc->hcto)) {
|
if (tick_isset(sc->hcto))
|
||||||
sc->ioto = sc->hcto;
|
sc->ioto = sc->hcto;
|
||||||
sc_ep_set_rex(sc, sc->ioto);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* on shutw we always wake the applet up */
|
/* on shutw we always wake the applet up */
|
||||||
appctx_wakeup(__sc_appctx(sc));
|
appctx_wakeup(__sc_appctx(sc));
|
||||||
@ -969,7 +930,6 @@ 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;
|
||||||
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;
|
||||||
}
|
}
|
||||||
@ -1010,9 +970,6 @@ 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(sc_ep_wex(sc)))
|
|
||||||
sc_ep_set_wex(sc, sc->ioto);
|
|
||||||
|
|
||||||
if (!channel_is_empty(oc)) {
|
if (!channel_is_empty(oc)) {
|
||||||
/* (re)start sending */
|
/* (re)start sending */
|
||||||
appctx_wakeup(__sc_appctx(sc));
|
appctx_wakeup(__sc_appctx(sc));
|
||||||
@ -1042,11 +999,6 @@ void sc_update_rx(struct stconn *sc)
|
|||||||
else
|
else
|
||||||
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))
|
|
||||||
sc_ep_reset_rex(sc);
|
|
||||||
else if (!tick_isset(sc_ep_rex(sc)))
|
|
||||||
sc_ep_set_rex(sc, sc->ioto);
|
|
||||||
|
|
||||||
sc_chk_rcv(sc);
|
sc_chk_rcv(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1072,29 +1024,12 @@ 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);
|
||||||
sc_ep_reset_wex(sc);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (re)start writing and update timeout. Note: we don't recompute the timeout
|
/* (re)start writing */
|
||||||
* every time we get here, otherwise it would risk never to expire. We only
|
|
||||||
* update it if is was not yet set. The stream socket handler will already
|
|
||||||
* 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(sc_ep_wex(sc))) {
|
|
||||||
sc_ep_set_wex(sc, sc->ioto);
|
|
||||||
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
|
|
||||||
* for incoming data or not. So in order to prevent the socket from
|
|
||||||
* expiring read timeouts during writes, we refresh the read timeout,
|
|
||||||
* except if it was already infinite or if we have explicitly setup
|
|
||||||
* independent streams.
|
|
||||||
*/
|
|
||||||
sc_ep_set_rex(sc, sc->ioto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is the equivalent to sc_update() except that it's
|
/* This function is the equivalent to sc_update() except that it's
|
||||||
@ -1121,7 +1056,6 @@ 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);
|
||||||
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
|
||||||
@ -1132,18 +1066,6 @@ static void sc_notify(struct stconn *sc)
|
|||||||
else if ((oc->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW)
|
else if ((oc->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW)
|
||||||
sc_ep_clr(sc, SE_FL_WAIT_DATA);
|
sc_ep_clr(sc, SE_FL_WAIT_DATA);
|
||||||
|
|
||||||
/* update OC timeouts and wake the other side up if it's waiting for room */
|
|
||||||
if (oc->flags & (CF_WRITE_EVENT)) {
|
|
||||||
if (sc_ep_test(sc, SE_FL_ERR_PENDING|SE_FL_ERROR) &&
|
|
||||||
!channel_is_empty(oc))
|
|
||||||
if (tick_isset(sc_ep_wex(sc)))
|
|
||||||
sc_ep_set_wex(sc, sc->ioto);
|
|
||||||
|
|
||||||
if (!(sc->flags & SC_FL_INDEP_STR))
|
|
||||||
if (tick_isset(sc_ep_rex(sc)))
|
|
||||||
sc_ep_set_rex(sc, sc->ioto);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (oc->flags & CF_DONT_READ)
|
if (oc->flags & CF_DONT_READ)
|
||||||
sc_wont_read(sco);
|
sc_wont_read(sco);
|
||||||
else
|
else
|
||||||
@ -1189,16 +1111,6 @@ static void sc_notify(struct stconn *sc)
|
|||||||
sc_chk_rcv(sc);
|
sc_chk_rcv(sc);
|
||||||
sc_chk_rcv(sco);
|
sc_chk_rcv(sco);
|
||||||
|
|
||||||
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_ep_reset_rex(sc);
|
|
||||||
}
|
|
||||||
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 */
|
|
||||||
if (tick_isset(sc_ep_rex(sc)))
|
|
||||||
sc_ep_set_rex(sc, sc->ioto);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* wake the task up only when needed */
|
/* wake the task up only when needed */
|
||||||
if (/* changes on the production side that must be handled:
|
if (/* changes on the production side that must be handled:
|
||||||
* - An error on receipt: SE_FL_ERROR
|
* - An error on receipt: SE_FL_ERROR
|
||||||
@ -1242,7 +1154,6 @@ static void sc_conn_read0(struct stconn *sc)
|
|||||||
return;
|
return;
|
||||||
ic->flags |= CF_SHUTR|CF_READ_EVENT;
|
ic->flags |= CF_SHUTR|CF_READ_EVENT;
|
||||||
sc_ep_report_read_activity(sc);
|
sc_ep_report_read_activity(sc);
|
||||||
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;
|
||||||
@ -1266,7 +1177,6 @@ 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;
|
||||||
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)
|
||||||
|
@ -855,7 +855,6 @@ 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);
|
||||||
|
|
||||||
sc_ep_set_wex(s->scf, s->scf->ioto);
|
|
||||||
channel_auto_read(oc);
|
channel_auto_read(oc);
|
||||||
channel_auto_close(oc);
|
channel_auto_close(oc);
|
||||||
channel_shutr_now(oc);
|
channel_shutr_now(oc);
|
||||||
@ -949,7 +948,6 @@ static void back_establish(struct stream *s)
|
|||||||
*/
|
*/
|
||||||
sc_chk_rcv(s->scb);
|
sc_chk_rcv(s->scb);
|
||||||
}
|
}
|
||||||
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)) {
|
||||||
@ -2426,11 +2424,6 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
|||||||
scf->ioto = sess->fe->timeout.clientfin;
|
scf->ioto = sess->fe->timeout.clientfin;
|
||||||
if ((req->flags & (CF_SHUTR|CF_SHUTW)) && tick_isset(s->be->timeout.serverfin))
|
if ((req->flags & (CF_SHUTR|CF_SHUTW)) && tick_isset(s->be->timeout.serverfin))
|
||||||
scb->ioto = s->be->timeout.serverfin;
|
scb->ioto = s->be->timeout.serverfin;
|
||||||
|
|
||||||
sc_ep_set_rex(scf, scf->ioto);
|
|
||||||
sc_ep_set_wex(scf, scb->ioto);
|
|
||||||
sc_ep_set_rex(scb, scb->ioto);
|
|
||||||
sc_ep_set_wex(scb, scf->ioto);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user