From a63f8f379faec39003dfcf3277f5879be45fda8c Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 20 Dec 2022 18:18:00 +0100 Subject: [PATCH] MINOR: channel: Remove CF_WRITE_ACTIVITY Thanks to previous changes, CF_WRITE_ACTIVITY flags can be removed. Everywhere it was used, its value is now directly used (CF_WRITE_EVENT|CF_WRITE_ERROR). --- include/haproxy/channel-t.h | 3 +-- include/haproxy/channel.h | 2 +- src/stconn.c | 4 ++-- src/stream.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/haproxy/channel-t.h b/include/haproxy/channel-t.h index 5996db427..c1ae613be 100644 --- a/include/haproxy/channel-t.h +++ b/include/haproxy/channel-t.h @@ -67,7 +67,6 @@ /* unused: 0x00000200 */ #define CF_WRITE_TIMEOUT 0x00000400 /* timeout while waiting for consumer */ #define CF_WRITE_ERROR 0x00000800 /* unrecoverable error on consumer side */ -#define CF_WRITE_ACTIVITY (CF_WRITE_EVENT|CF_WRITE_ERROR) #define CF_WAKE_WRITE 0x00001000 /* wake the task up when there's write activity */ #define CF_SHUTW 0x00002000 /* consumer has already shut down */ @@ -122,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_ACTIVITY|CF_WAKE_ONCE) +#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) /* 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) diff --git a/include/haproxy/channel.h b/include/haproxy/channel.h index 3b024e8a7..515453c00 100644 --- a/include/haproxy/channel.h +++ b/include/haproxy/channel.h @@ -534,7 +534,7 @@ static inline void channel_check_timeouts(struct channel *chn) unlikely(tick_is_expired(chn->rex, now_ms))) chn->flags |= CF_READ_TIMEOUT; - if (likely(!(chn->flags & (CF_SHUTW|CF_WRITE_TIMEOUT|CF_WRITE_ACTIVITY))) && + if (likely(!(chn->flags & (CF_SHUTW|CF_WRITE_TIMEOUT|CF_WRITE_EVENT|CF_WRITE_ERROR))) && unlikely(tick_is_expired(chn->wex, now_ms))) chn->flags |= CF_WRITE_TIMEOUT; diff --git a/src/stconn.c b/src/stconn.c index 24b04cc2d..75904238d 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -826,7 +826,7 @@ static void sc_app_chk_snd_conn(struct stconn *sc) oc->wex = tick_add_ifset(now_ms, oc->wto); } - if (likely(oc->flags & CF_WRITE_ACTIVITY)) { + if (likely(oc->flags & (CF_WRITE_EVENT|CF_WRITE_ERROR))) { struct channel *ic = sc_ic(sc); /* update timeout if we have written something */ @@ -1126,7 +1126,7 @@ static void sc_notify(struct stconn *sc) 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_ACTIVITY) { + if (oc->flags & (CF_WRITE_EVENT|CF_WRITE_ERROR)) { if ((oc->flags & (CF_SHUTW|CF_WRITE_EVENT)) == CF_WRITE_EVENT && !channel_is_empty(oc)) if (tick_isset(oc->wex)) diff --git a/src/stream.c b/src/stream.c index f727788c5..92aff7717 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_ACTIVITY|CF_WRITE_TIMEOUT|CF_ANA_TIMEOUT)) && + CF_WRITE_EVENT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT|CF_ANA_TIMEOUT)) && !(s->flags & SF_CONN_EXP) && !((sc_ep_get(scf) | scb->flags) & SE_FL_ERROR) && ((s->pending_events & TASK_WOKEN_ANY) == TASK_WOKEN_TIMER)) {