]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: channel: Remove CF_READ_NOEXP flag
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 16 Feb 2023 15:47:33 +0000 (16:47 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 22 Feb 2023 13:52:14 +0000 (14:52 +0100)
This flag was introduced in 1.3 to fix a design issue. It was untouch since
then but there is no reason to still have this trick. Note it could be good
to review what happens in HTTP with the server is waiting for the end of the
request. It could be good to be sure a client timeout is always reported.

include/haproxy/channel-t.h
include/haproxy/channel.h
src/cli.c
src/stconn.c
src/stream.c

index 18ebc037320c20207a9ea51d0d8ffefb3e5687c4..287b712ac3bea35f15d6f005385d23e69ba6e7f5 100644 (file)
@@ -61,7 +61,7 @@
 /* unused: 0x00000010 */
 #define CF_SHUTR          0x00000020  /* producer has already shut down */
 #define CF_SHUTR_NOW      0x00000040  /* the producer must shut down for reads ASAP */
-#define CF_READ_NOEXP     0x00000080  /* producer should not expire */
+/* 0x00000080 unused */
 
 #define CF_WRITE_EVENT    0x00000100  /* a write event detected on consumer side */
 /* unused: 0x00000200 */
@@ -136,14 +136,14 @@ static forceinline char *chn_show_flags(char *buf, size_t len, const char *delim
        _(0);
        /* flags */
        _(CF_READ_EVENT, _(CF_READ_TIMEOUT, _(CF_READ_ERROR,
-       _(CF_SHUTR, _(CF_SHUTR_NOW, _(CF_READ_NOEXP, _(CF_WRITE_EVENT,
+       _(CF_SHUTR, _(CF_SHUTR_NOW, _(CF_WRITE_EVENT,
        _(CF_WRITE_TIMEOUT, _(CF_WRITE_ERROR,
        _(CF_WAKE_WRITE, _(CF_SHUTW, _(CF_SHUTW_NOW, _(CF_AUTO_CLOSE,
        _(CF_STREAMER, _(CF_STREAMER_FAST, _(CF_WROTE_DATA,
        _(CF_KERN_SPLICING, _(CF_READ_DONTWAIT,
        _(CF_AUTO_CONNECT, _(CF_DONT_READ, _(CF_EXPECT_MORE,
        _(CF_SEND_DONTWAIT, _(CF_NEVER_WAIT, _(CF_WAKE_ONCE, _(CF_FLT_ANALYZE,
-       _(CF_EOI, _(CF_ISRESP)))))))))))))))))))))))))));
+       _(CF_EOI, _(CF_ISRESP))))))))))))))))))))))))));
        /* epilogue */
        _(~0U);
        return buf;
index 8ef5b863d5c58c137b9b285c99d6664a5fdf50e4..053bc24c47214659498dee7812e5266dfd36ed31 100644 (file)
@@ -530,7 +530,7 @@ static inline int channel_output_closed(struct channel *chn)
  */
 static inline void channel_check_timeouts(struct channel *chn)
 {
-       if (likely(!(chn->flags & (CF_SHUTR|CF_READ_TIMEOUT|CF_READ_EVENT|CF_READ_NOEXP))) &&
+       if (likely(!(chn->flags & (CF_SHUTR|CF_READ_TIMEOUT|CF_READ_EVENT))) &&
            unlikely(tick_is_expired(chn->rex, now_ms)))
                chn->flags |= CF_READ_TIMEOUT;
 
index a54146434b5f6d1c21a1a12fca369720cfb29e6e..44ca4e85c0cb7220f2c073591c793da28a72018f 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2784,7 +2784,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
                sc_set_state(s->scb, SC_ST_INI);
                s->scb->flags &= SC_FL_ISBACK | SC_FL_DONT_WAKE; /* we're in the context of process_stream */
                s->req.flags &= ~(CF_SHUTW|CF_SHUTW_NOW|CF_AUTO_CONNECT|CF_WRITE_ERROR|CF_STREAMER|CF_STREAMER_FAST|CF_NEVER_WAIT|CF_WROTE_DATA);
-               s->res.flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_READ_ERROR|CF_READ_NOEXP|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_EVENT|CF_NEVER_WAIT|CF_WROTE_DATA|CF_READ_EVENT);
+               s->res.flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_READ_ERROR|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_EVENT|CF_NEVER_WAIT|CF_WROTE_DATA|CF_READ_EVENT);
                s->flags &= ~(SF_DIRECT|SF_ASSIGNED|SF_BE_ASSIGNED|SF_FORCE_PRST|SF_IGNORE_PRST);
                s->flags &= ~(SF_CURR_SESS|SF_REDIRECTABLE|SF_SRV_REUSED);
                s->flags &= ~(SF_ERR_MASK|SF_FINST_MASK|SF_REDISP);
index 6dfdfaff43eebb18833b4d160a65ea11aedad599..0b3147a00f8528208a2b107a3ce97b803c689bb5 100644 (file)
@@ -1043,7 +1043,7 @@ void sc_update_rx(struct stconn *sc)
 
        if ((ic->flags & CF_EOI) || sc->flags & (SC_FL_WONT_READ|SC_FL_NEED_BUFF|SC_FL_NEED_ROOM))
                ic->rex = TICK_ETERNITY;
-       else if (!(ic->flags & CF_READ_NOEXP) && !tick_isset(ic->rex))
+       else if (!tick_isset(ic->rex))
                ic->rex = tick_add_ifset(now_ms, ic->rto);
 
        sc_chk_rcv(sc);
@@ -1195,7 +1195,7 @@ static void sc_notify(struct stconn *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 (!(ic->flags & CF_READ_NOEXP) && tick_isset(ic->rex))
+               if (tick_isset(ic->rex))
                        ic->rex = tick_add_ifset(now_ms, ic->rto);
        }
 
index 8f58e0d67b70d94db18fb5ad52d7c57bd58d9e76..382aeda49d9906703bb3875b0b444809cc4bcd47 100644 (file)
@@ -1720,8 +1720,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
                memset(&s->txn->auth, 0, sizeof(s->txn->auth));
 
        /* This flag must explicitly be set every time */
-       req->flags &= ~(CF_READ_NOEXP|CF_WAKE_WRITE);
-       res->flags &= ~(CF_READ_NOEXP|CF_WAKE_WRITE);
+       req->flags &= ~CF_WAKE_WRITE;
+       res->flags &= ~CF_WAKE_WRITE;
 
        /* Keep a copy of req/rep flags so that we can detect shutdowns */
        rqf_last = req->flags & ~CF_MASK_ANALYSER;
@@ -2544,20 +2544,6 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
 
                stream_update_both_sc(s);
 
-               /* Trick: if a request is being waiting for the server to respond,
-                * and if we know the server can timeout, we don't want the timeout
-                * to expire on the client side first, but we're still interested
-                * in passing data from the client to the server (eg: POST). Thus,
-                * we can cancel the client's request timeout if the server's
-                * request timeout is set and the server has not yet sent a response.
-                */
-
-               if ((res->flags & (CF_AUTO_CLOSE|CF_SHUTR)) == 0 &&
-                   (tick_isset(req->wex) || tick_isset(res->rex))) {
-                       req->flags |= CF_READ_NOEXP;
-                       req->rex = TICK_ETERNITY;
-               }
-
                /* Reset pending events now */
                s->pending_events = 0;