diff --git a/include/haproxy/sc_strm.h b/include/haproxy/sc_strm.h index 8810d616a..98b803dd1 100644 --- a/include/haproxy/sc_strm.h +++ b/include/haproxy/sc_strm.h @@ -379,11 +379,25 @@ static inline int sc_snd_may_expire(const struct stconn *sc) return 1; } +static forceinline int sc_ep_rcv_ex(const struct stconn *sc) +{ + return ((tick_isset(sc->sedesc->lra) && sc_rcv_may_expire(sc)) + ? tick_add_ifset(sc->sedesc->lra, sc->ioto) + : TICK_ETERNITY); +} + +static forceinline int sc_ep_snd_ex(const struct stconn *sc) +{ + return ((tick_isset(sc->sedesc->fsb) && sc_snd_may_expire(sc)) + ? tick_add_ifset(sc->sedesc->fsb, sc->ioto) + : TICK_ETERNITY); +} + static inline void sc_check_timeouts(const struct stconn *sc) { - if (likely(sc_rcv_may_expire(sc)) && unlikely(tick_is_expired(sc_ep_rcv_ex(sc), now_ms))) + if (unlikely(tick_is_expired(sc_ep_rcv_ex(sc), now_ms))) sc_ic(sc)->flags |= CF_READ_TIMEOUT; - if (likely(sc_snd_may_expire(sc)) && unlikely(tick_is_expired(sc_ep_snd_ex(sc), now_ms))) + if (unlikely(tick_is_expired(sc_ep_snd_ex(sc), now_ms))) sc_oc(sc)->flags |= CF_WRITE_TIMEOUT; } diff --git a/include/haproxy/stconn.h b/include/haproxy/stconn.h index 4ba6aca20..3b24b217e 100644 --- a/include/haproxy/stconn.h +++ b/include/haproxy/stconn.h @@ -210,20 +210,6 @@ static forceinline size_t sc_ep_ff_data(struct stconn *sc) return se_ff_data(sc->sedesc); } -static forceinline int sc_ep_rcv_ex(const struct stconn *sc) -{ - return (tick_isset(sc->sedesc->lra) - ? tick_add_ifset(sc->sedesc->lra, sc->ioto) - : TICK_ETERNITY); -} - -static forceinline int sc_ep_snd_ex(const struct stconn *sc) -{ - return (tick_isset(sc->sedesc->fsb) - ? tick_add_ifset(sc->sedesc->fsb, sc->ioto) - : TICK_ETERNITY); -} - /* Returns the stream endpoint from an connector, without any control */ static inline void *__sc_endp(const struct stconn *sc) { diff --git a/src/stream.c b/src/stream.c index ef8d46625..6a6166eea 100644 --- a/src/stream.c +++ b/src/stream.c @@ -2518,17 +2518,6 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) update_exp_and_leave: /* Note: please ensure that if you branch here you disable SC_FL_DONT_WAKE */ - t->expire = (tick_is_expired(t->expire, now_ms) ? 0 : t->expire); - - if (likely(sc_rcv_may_expire(scf))) - t->expire = tick_first(t->expire, sc_ep_rcv_ex(scf)); - if (likely(sc_snd_may_expire(scf))) - t->expire = tick_first(t->expire, sc_ep_snd_ex(scf)); - if (likely(sc_rcv_may_expire(scb))) - t->expire = tick_first(t->expire, sc_ep_rcv_ex(scb)); - if (likely(sc_snd_may_expire(scb))) - t->expire = tick_first(t->expire, sc_ep_snd_ex(scb)); - if (!req->analysers) req->analyse_exp = TICK_ETERNITY; if (!res->analysers) @@ -2538,10 +2527,13 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) (!tick_isset(req->analyse_exp) || tick_is_expired(req->analyse_exp, now_ms))) req->analyse_exp = tick_add(now_ms, 5000); + t->expire = (tick_is_expired(t->expire, now_ms) ? 0 : t->expire); + t->expire = tick_first(t->expire, sc_ep_rcv_ex(scf)); + t->expire = tick_first(t->expire, sc_ep_snd_ex(scf)); + t->expire = tick_first(t->expire, sc_ep_rcv_ex(scb)); + t->expire = tick_first(t->expire, sc_ep_snd_ex(scb)); t->expire = tick_first(t->expire, req->analyse_exp); - t->expire = tick_first(t->expire, res->analyse_exp); - t->expire = tick_first(t->expire, s->conn_exp); if (unlikely(tick_is_expired(t->expire, now_ms))) {