MINOR: channel/applets: Stop to test CF_WRITE_ERROR flag if CF_SHUTW is enough

In applets, we stop processing when a write error (CF_WRITE_ERROR) or a shutdown
for writes (CF_SHUTW) is detected. However, any write error leads to an
immediate shutdown for writes. Thus, it is enough to only test if CF_SHUTW is
set.
diff --git a/src/activity.c b/src/activity.c
index f697358..5ee5fbb 100644
--- a/src/activity.c
+++ b/src/activity.c
@@ -624,7 +624,7 @@
 	int max_lines;
 	int i, j, max;
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		return 1;
 
 	chunk_reset(&trash);
@@ -887,7 +887,7 @@
 	int thr, queue;
 	int i, max;
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		return 1;
 
 	/* It's not possible to scan queues in small chunks and yield in the
@@ -1027,7 +1027,7 @@
 	struct timeval up;
 	int thr;
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		return 1;
 
 	chunk_reset(&trash);
diff --git a/src/cli.c b/src/cli.c
index 23f77e5..ced990c 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -1227,7 +1227,7 @@
 	struct stconn *sc = appctx_sc(appctx);
 	char **var = ctx->var;
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		return 1;
 
 	chunk_reset(&trash);
@@ -1264,7 +1264,7 @@
 	int fd = fdctx->fd;
 	int ret = 1;
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		goto end;
 
 	chunk_reset(&trash);
diff --git a/src/debug.c b/src/debug.c
index c9b912e..05c7a5c 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -313,7 +313,7 @@
 	struct stconn *sc = appctx_sc(appctx);
 	int thr;
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		return 1;
 
 	if (appctx->st0)
@@ -1096,7 +1096,7 @@
 	int ret = 1;
 	int i, fd;
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		goto end;
 
 	chunk_reset(&trash);
@@ -1303,7 +1303,7 @@
 	const char *pfx = ctx->match;
 	int ret = 1;
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		goto end;
 
 	if (!ctx->width) {
diff --git a/src/dns.c b/src/dns.c
index a6e6af8..883c293 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -459,8 +459,7 @@
 	if (ds->shutdown)
 		goto close;
 
-	/* an error was detected */
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		goto close;
 
 	/* con closed by server side, we will skip data write and drain data from channel */
diff --git a/src/map.c b/src/map.c
index 46125ad..9713041 100644
--- a/src/map.c
+++ b/src/map.c
@@ -348,7 +348,7 @@
 	struct stconn *sc = appctx_sc(appctx);
 	struct pat_ref_elt *elt;
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW)) {
 		/* If we're forced to shut down, we might have to remove our
 		 * reference to the last ref_elt being dumped.
 		 */
diff --git a/src/mworker.c b/src/mworker.c
index 82fa2a2..8b3be19 100644
--- a/src/mworker.c
+++ b/src/mworker.c
@@ -534,7 +534,7 @@
 	char *uptime = NULL;
 	char *reloadtxt = NULL;
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		return 1;
 
 	chunk_reset(&trash);
@@ -669,7 +669,7 @@
 	if (!cli_has_level(appctx, ACCESS_LVL_OPER))
 		return 1;
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		return 1;
 
 
diff --git a/src/proxy.c b/src/proxy.c
index e53cc4f..a0e8c15 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -3189,7 +3189,7 @@
 	struct stconn *sc = appctx_sc(appctx);
 	extern const char *monthname[12];
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		return 1;
 
 	chunk_reset(&trash);
diff --git a/src/ring.c b/src/ring.c
index 91157a9..22ac304 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -347,7 +347,7 @@
 	size_t len, cnt;
 	int ret;
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		return 1;
 
 	HA_RWLOCK_WRLOCK(LOGSRV_LOCK, &ring->lock);
diff --git a/src/sink.c b/src/sink.c
index 3d0fda2..862a1ae 100644
--- a/src/sink.c
+++ b/src/sink.c
@@ -330,8 +330,7 @@
 	/* rto should not change but it seems the case */
 	sc_oc(sc)->rto = TICK_ETERNITY;
 
-	/* an error was detected */
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		goto close;
 
 	/* con closed by server side */
@@ -480,7 +479,7 @@
 	sc_oc(sc)->rto = TICK_ETERNITY;
 
 	/* an error was detected */
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		goto close;
 
 	/* con closed by server side */
diff --git a/src/ssl_ckch.c b/src/ssl_ckch.c
index f8e63ed..7d07cad 100644
--- a/src/ssl_ckch.c
+++ b/src/ssl_ckch.c
@@ -2148,7 +2148,7 @@
 	struct ckch_store *old_ckchs, *new_ckchs = NULL;
 	struct ckch_inst *ckchi;
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		goto end;
 
 	while (1) {
diff --git a/src/ssl_crtlist.c b/src/ssl_crtlist.c
index 9027d0e..e76fb9a 100644
--- a/src/ssl_crtlist.c
+++ b/src/ssl_crtlist.c
@@ -1098,7 +1098,7 @@
 	/* for each bind_conf which use the crt-list, a new ckch_inst must be
 	 * created.
 	 */
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW))
 		goto end;
 
 	switch (ctx->state) {
diff --git a/src/stconn.c b/src/stconn.c
index 7590423..ab11ee8 100644
--- a/src/stconn.c
+++ b/src/stconn.c
@@ -850,7 +850,7 @@
 	/* in case of special condition (error, shutdown, end of write...), we
 	 * have to notify the task.
 	 */
-	if (likely((oc->flags & (CF_WRITE_EVENT|CF_WRITE_ERROR|CF_SHUTW)) ||
+	if (likely((oc->flags & (CF_WRITE_EVENT|CF_SHUTW)) ||
 	          ((oc->flags & CF_WAKE_WRITE) &&
 	           ((channel_is_empty(oc) && !oc->to_forward) ||
 	            !sc_state_in(sc->state, SC_SB_EST))))) {
@@ -1127,7 +1127,7 @@
 
 	/* update OC timeouts and wake the other side up if it's waiting for room */
 	if (oc->flags & (CF_WRITE_EVENT|CF_WRITE_ERROR)) {
-		if ((oc->flags & (CF_SHUTW|CF_WRITE_EVENT)) == CF_WRITE_EVENT &&
+		if (!(oc->flags & CF_WRITE_ERROR) &&
 		    !channel_is_empty(oc))
 			if (tick_isset(oc->wex))
 				oc->wex = tick_add_ifset(now_ms, oc->wto);
diff --git a/src/stick_table.c b/src/stick_table.c
index b6f3ef1..09c7c74 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -5022,7 +5022,7 @@
 	 *     data though.
 	 */
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW)) {
 		/* in case of abort, remove any refcount we might have set on an entry */
 		if (ctx->state == STATE_DUMP) {
 			stksess_kill_if_expired(ctx->t, ctx->entry, 1);
diff --git a/src/stream.c b/src/stream.c
index 8367c89..a4b428c 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1782,7 +1782,7 @@
 		 */
 		if (!((req->flags | res->flags) &
 		      (CF_SHUTR|CF_READ_EVENT|CF_READ_TIMEOUT|CF_SHUTW|
-		       CF_WRITE_EVENT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT)) &&
+		       CF_WRITE_EVENT|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)) {
@@ -3626,7 +3626,7 @@
 		goto done;
 	}
 
-	if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
+	if (unlikely(sc_ic(sc)->flags & CF_SHUTW)) {
 		/* If we're forced to shut down, we might have to remove our
 		 * reference to the last stream being dumped.
 		 */