From: Christopher Faulet Date: Tue, 20 Dec 2022 17:28:27 +0000 (+0100) Subject: MINOR: channel: Remove CF_ANA_TIMEOUT and report CF_READ_EVENT instead X-Git-Tag: v2.8-dev2~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=049fbcd36a8c94906d752eb868f79ecd0034c2c9;p=thirdparty%2Fhaproxy.git MINOR: channel: Remove CF_ANA_TIMEOUT and report CF_READ_EVENT instead It appears CF_ANA_TIMEOUT is flag only used in CF_MASK_ANALYSER. All analyzer timeout relies on the analysis expiration date (chn->analyse_exp). Worst, once set, this flag is never removed. Thus this flag can be removed and replaced by a read event (CF_READ_EVENT). --- diff --git a/include/haproxy/channel-t.h b/include/haproxy/channel-t.h index c1ae613be1..b9b86f8657 100644 --- a/include/haproxy/channel-t.h +++ b/include/haproxy/channel-t.h @@ -104,7 +104,7 @@ #define CF_STREAMER_FAST 0x00020000 /* the consumer seems to eat the stream very fast */ #define CF_WROTE_DATA 0x00040000 /* some data were sent from this buffer */ -#define CF_ANA_TIMEOUT 0x00080000 /* the analyser timeout has expired */ +/* unused 0x00080000 */ #define CF_READ_ATTACHED 0x00100000 /* the read side is attached for the first time */ #define CF_KERN_SPLICING 0x00200000 /* kernel splicing desired for this channel */ #define CF_READ_DONTWAIT 0x00400000 /* wake the task up after every read (eg: HTTP request) */ @@ -121,7 +121,7 @@ #define CF_ISRESP 0x80000000 /* 0 = request channel, 1 = response channel */ /* Masks which define input events for stream analysers */ -#define CF_MASK_ANALYSER (CF_READ_ATTACHED|CF_READ_EVENT|CF_READ_ERROR|CF_READ_TIMEOUT|CF_ANA_TIMEOUT|CF_WRITE_EVENT|CF_WRITE_ERROR|CF_WAKE_ONCE) +#define CF_MASK_ANALYSER (CF_READ_ATTACHED|CF_READ_EVENT|CF_READ_ERROR|CF_READ_TIMEOUT|CF_WRITE_EVENT|CF_WRITE_ERROR|CF_WAKE_ONCE) /* Mask for static flags which cause analysers to be woken up when they change */ #define CF_MASK_STATIC (CF_SHUTR|CF_SHUTW|CF_SHUTR_NOW|CF_SHUTW_NOW) @@ -140,11 +140,11 @@ static forceinline char *chn_show_flags(char *buf, size_t len, const char *delim _(CF_SHUTR, _(CF_SHUTR_NOW, _(CF_READ_NOEXP, _(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_ANA_TIMEOUT, + _(CF_STREAMER, _(CF_STREAMER_FAST, _(CF_WROTE_DATA, _(CF_READ_ATTACHED, _(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; diff --git a/include/haproxy/channel.h b/include/haproxy/channel.h index 515453c005..fa504b1eaf 100644 --- a/include/haproxy/channel.h +++ b/include/haproxy/channel.h @@ -538,9 +538,9 @@ static inline void channel_check_timeouts(struct channel *chn) unlikely(tick_is_expired(chn->wex, now_ms))) chn->flags |= CF_WRITE_TIMEOUT; - if (likely(!(chn->flags & CF_ANA_TIMEOUT)) && + if (likely(!(chn->flags & CF_READ_EVENT)) && unlikely(tick_is_expired(chn->analyse_exp, now_ms))) - chn->flags |= CF_ANA_TIMEOUT; + chn->flags |= CF_READ_EVENT; } /* Erase any content from channel and adjusts flags accordingly. Note diff --git a/src/stream.c b/src/stream.c index 92aff7717b..b267dbb042 100644 --- a/src/stream.c +++ b/src/stream.c @@ -1783,7 +1783,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) */ if (!((req->flags | res->flags) & (CF_SHUTR|CF_READ_EVENT|CF_READ_ERROR|CF_READ_TIMEOUT|CF_SHUTW| - CF_WRITE_EVENT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT|CF_ANA_TIMEOUT)) && + CF_WRITE_EVENT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT)) && !(s->flags & SF_CONN_EXP) && !((sc_ep_get(scf) | scb->flags) & SE_FL_ERROR) && ((s->pending_events & TASK_WOKEN_ANY) == TASK_WOKEN_TIMER)) {