diff --git a/include/haproxy/stconn-t.h b/include/haproxy/stconn-t.h index ea8e63eb9..019533b0b 100644 --- a/include/haproxy/stconn-t.h +++ b/include/haproxy/stconn-t.h @@ -201,8 +201,6 @@ struct stconn; * is the stream connector we're attached to, or NULL * is the last read activity * is the first send blocked - * is the expiration date for a read, in ticks - * is the expiration date for a write or connect, in ticks * SE_FL_* * * should be updated when a read activity is detected. It can be a @@ -219,8 +217,6 @@ struct sedesc { unsigned int flags; unsigned int lra; unsigned int fsb; - int rex; - int wex; }; /* sc_app_ops describes the application layer's operations and notification diff --git a/include/haproxy/stconn.h b/include/haproxy/stconn.h index 211a5d1a8..10395accd 100644 --- a/include/haproxy/stconn.h +++ b/include/haproxy/stconn.h @@ -187,37 +187,6 @@ static forceinline int sc_ep_snd_ex(const struct stconn *sc) : 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 */ static inline void *__sc_endp(const struct stconn *sc) { diff --git a/src/cli.c b/src/cli.c index 7058d7b0e..af45c27d2 100644 --- a/src/cli.c +++ b/src/cli.c @@ -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->scb->ioto = TICK_ETERNITY; - sc_ep_reset_rex(s->scf); - sc_ep_reset_wex(s->scf); 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->scb->hcto = TICK_ETERNITY; /* we're removing the analysers, we MUST re-enable events detection. diff --git a/src/debug.c b/src/debug.c index 135affd6f..9f9a87dcd 100644 --- a/src/debug.c +++ b/src/debug.c @@ -761,7 +761,7 @@ static int debug_parse_cli_stream(char **args, char *payload, struct appctx *app return cli_err(appctx, "Usage: debug dev stream { | wake }*\n" " = {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" " = {'' (show) | '=' (assign) | '^' (xor) | '+' (or) | '-' (andnot)}\n" " = '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); } else if (isteq(name, ist("scf.s"))) { 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"))) { 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"))) { 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); diff --git a/src/dns.c b/src/dns.c index 9b09dfb05..dc84242e3 100644 --- a/src/dns.c +++ b/src/dns.c @@ -834,10 +834,6 @@ static int dns_session_init(struct appctx *appctx) s->uniq_id = 0; 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); ds->appctx = appctx; return 0; diff --git a/src/hlua.c b/src/hlua.c index be3c1ac03..cc8624c50 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -2523,9 +2523,6 @@ static int hlua_socket_write_yield(struct lua_State *L,int status, lua_KContext /* update buffers. */ appctx_wakeup(appctx); - sc_ep_reset_rex(s->scf);; - sc_ep_reset_wex(s->scb); - /* Update length sent. */ lua_pop(L, 1); 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->scf->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); task_queue(s->task); @@ -8083,7 +8076,6 @@ __LJMP static int hlua_txn_done(lua_State *L) channel_auto_close(req); channel_erase(req); - sc_ep_set_wex(s->scb, s->scf->ioto); channel_auto_read(res); channel_auto_close(res); channel_shutr_now(res); diff --git a/src/http_ana.c b/src/http_ana.c index cc4163cdc..80263e61a 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -4438,7 +4438,6 @@ int http_forward_proxy_resp(struct stream *s, int final) channel_auto_close(req); channel_htx_erase(req, htxbuf(&req->buf)); - sc_ep_set_wex(s->scb, s->scf->ioto); channel_auto_read(res); channel_auto_close(res); channel_shutr_now(res); @@ -4492,8 +4491,6 @@ void http_reply_and_close(struct stream *s, short status, struct http_reply *msg } end: - sc_ep_set_wex(s->scb, s->scf->ioto); - /* At this staged, HTTP analysis is finished */ s->req.analysers &= AN_REQ_FLT_END; s->req.analyse_exp = TICK_ETERNITY; diff --git a/src/sink.c b/src/sink.c index bd04ec885..44ad629cd 100644 --- a/src/sink.c +++ b/src/sink.c @@ -322,12 +322,6 @@ static void sink_forward_io_handler(struct appctx *appctx) if (unlikely(stopping)) 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)) goto close; @@ -467,12 +461,6 @@ static void sink_forward_oc_io_handler(struct appctx *appctx) if (unlikely(stopping)) 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 */ if (unlikely(sc_ic(sc)->flags & CF_SHUTW)) goto close; @@ -626,10 +614,6 @@ static int sink_forward_session_init(struct appctx *appctx) s->uniq_id = 0; 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); sft->appctx = appctx; diff --git a/src/stconn.c b/src/stconn.c index e6b7d597d..ae537661f 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -94,7 +94,6 @@ void sedesc_init(struct sedesc *sedesc) sedesc->sc = NULL; sedesc->lra = TICK_ETERNITY; sedesc->fsb = TICK_ETERNITY; - sedesc->rex = sedesc->wex = TICK_ETERNITY; 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; 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)) return; @@ -570,12 +568,9 @@ static void sc_app_shutw(struct stconn *sc) if (oc->flags & CF_SHUTW) return; 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_ep_set_rex(sc, sc->ioto); - } switch (sc->state) { case SC_ST_RDY: @@ -601,7 +596,6 @@ static void sc_app_shutw(struct stconn *sc) default: sc->flags &= ~SC_FL_NOLINGER; ic->flags |= CF_SHUTR; - sc_ep_reset_rex(sc); if (sc->flags & SC_FL_ISBACK) __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. */ 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)) 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) return; 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)) return; @@ -711,12 +701,9 @@ static void sc_app_shutw_conn(struct stconn *sc) if (oc->flags & CF_SHUTW) return; 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_ep_set_rex(sc, sc->ioto); - } switch (sc->state) { case SC_ST_RDY: @@ -767,7 +754,6 @@ static void sc_app_shutw_conn(struct stconn *sc) default: sc->flags &= ~SC_FL_NOLINGER; ic->flags |= CF_SHUTR; - sc_ep_reset_rex(sc); if (sc->flags & SC_FL_ISBACK) __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) sc_ep_set(sc, SE_FL_WAIT_DATA); - sc_ep_reset_wex(sc); } else { /* Otherwise there are remaining data to be sent in the buffer, * which means we have to poll before doing so. */ 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 @@ -899,7 +864,6 @@ static void sc_app_shutr_applet(struct stconn *sc) if (ic->flags & CF_SHUTR) return; ic->flags |= CF_SHUTR|CF_READ_EVENT; - sc_ep_reset_rex(sc); /* 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) return; 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_ep_set_rex(sc, sc->ioto); - } /* on shutw we always wake the applet up */ appctx_wakeup(__sc_appctx(sc)); @@ -969,7 +930,6 @@ static void sc_app_shutw_applet(struct stconn *sc) default: sc->flags &= ~SC_FL_NOLINGER; ic->flags |= CF_SHUTR; - sc_ep_reset_rex(sc); if (sc->flags & SC_FL_ISBACK) __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)) return; - if (!tick_isset(sc_ep_wex(sc))) - sc_ep_set_wex(sc, sc->ioto); - if (!channel_is_empty(oc)) { /* (re)start sending */ appctx_wakeup(__sc_appctx(sc)); @@ -1042,11 +999,6 @@ void sc_update_rx(struct stconn *sc) else 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); } @@ -1072,29 +1024,12 @@ void sc_update_tx(struct stconn *sc) if (!sc_ep_test(sc, SE_FL_WAIT_DATA)) { if ((oc->flags & CF_SHUTW_NOW) == 0) sc_ep_set(sc, SE_FL_WAIT_DATA); - sc_ep_reset_wex(sc); } return; } - /* (re)start writing and update timeout. Note: we don't recompute the timeout - * 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. - */ + /* (re)start writing */ 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 @@ -1121,7 +1056,6 @@ static void sc_notify(struct stconn *sc) 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_shutw(sc); - sc_ep_reset_wex(sc); } /* 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) 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) sc_wont_read(sco); else @@ -1189,16 +1111,6 @@ static void sc_notify(struct stconn *sc) sc_chk_rcv(sc); 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 */ if (/* changes on the production side that must be handled: * - An error on receipt: SE_FL_ERROR @@ -1242,7 +1154,6 @@ static void sc_conn_read0(struct stconn *sc) return; ic->flags |= CF_SHUTR|CF_READ_EVENT; 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)) return; @@ -1266,7 +1177,6 @@ static void sc_conn_read0(struct stconn *sc) oc->flags &= ~CF_SHUTW_NOW; oc->flags |= CF_SHUTW; - sc_ep_reset_wex(sc); sc->state = SC_ST_DIS; if (sc->flags & SC_FL_ISBACK) diff --git a/src/stream.c b/src/stream.c index 88c6ade60..533c3ee9b 100644 --- a/src/stream.c +++ b/src/stream.c @@ -855,7 +855,6 @@ void stream_retnclose(struct stream *s, const struct buffer *msg) if (likely(msg && msg->data)) co_inject(oc, msg->area, msg->data); - sc_ep_set_wex(s->scf, s->scf->ioto); channel_auto_read(oc); channel_auto_close(oc); channel_shutr_now(oc); @@ -949,7 +948,6 @@ static void back_establish(struct stream *s) */ 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 * left to send, or can't, switch to SC_ST_DIS now. */ 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; if ((req->flags & (CF_SHUTR|CF_SHUTW)) && tick_isset(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); } }