MINOR: stconn: Rename SC_FL_SHUTW in SC_FL_SHUT_DONE

Here again, it is just a flag renaming. In SC flags, there is no longer
shutdown for writes but shutdowns.
diff --git a/include/haproxy/channel.h b/include/haproxy/channel.h
index 54b0fc2..805aa26 100644
--- a/include/haproxy/channel.h
+++ b/include/haproxy/channel.h
@@ -520,7 +520,7 @@
 /* Returns true if the channel's output is already closed */
 static inline int channel_output_closed(struct channel *chn)
 {
-	return ((chn_cons(chn)->flags & SC_FL_SHUTW) != 0);
+	return ((chn_cons(chn)->flags & SC_FL_SHUT_DONE) != 0);
 }
 
 /* Check channel timeouts, and set the corresponding flags. */
@@ -977,8 +977,8 @@
 static inline int co_getchr(struct channel *chn)
 {
 	/* closed or empty + imminent close = -2; empty = -1 */
-	if (unlikely((chn_cons(chn)->flags & SC_FL_SHUTW) || channel_is_empty(chn))) {
-		if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+	if (unlikely((chn_cons(chn)->flags & SC_FL_SHUT_DONE) || channel_is_empty(chn))) {
+		if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
 			return -2;
 		return -1;
 	}
diff --git a/include/haproxy/sc_strm.h b/include/haproxy/sc_strm.h
index a53b3d7..43cfcef 100644
--- a/include/haproxy/sc_strm.h
+++ b/include/haproxy/sc_strm.h
@@ -356,7 +356,7 @@
 __attribute__((warn_unused_result))
 static inline int sc_is_send_allowed(const struct stconn *sc)
 {
-	if (sc->flags & SC_FL_SHUTW)
+	if (sc->flags & SC_FL_SHUT_DONE)
 		return 0;
 
 	return !sc_ep_test(sc, SE_FL_WAIT_DATA | SE_FL_WONT_CONSUME);
@@ -376,7 +376,7 @@
 
 static inline int sc_snd_may_expire(const struct stconn *sc)
 {
-	if ((sc->flags & SC_FL_SHUTW) ||
+	if ((sc->flags & SC_FL_SHUT_DONE) ||
 	    (sc_oc(sc)->flags & (CF_WRITE_TIMEOUT|CF_WRITE_EVENT)))
 		return 0;
 	if (sc_ep_test(sc, SE_FL_WONT_CONSUME))
diff --git a/include/haproxy/stconn-t.h b/include/haproxy/stconn-t.h
index 1beac15..c42b81a 100644
--- a/include/haproxy/stconn-t.h
+++ b/include/haproxy/stconn-t.h
@@ -161,7 +161,7 @@
 	SC_FL_ABRT_WANTED   = 0x00002000,  /* An abort was requested and must be performed ASAP */
 	SC_FL_SHUT_WANTED   = 0x00004000,  /* A shutdown was requested and mux be performed ASAP */
 	SC_FL_ABRT_DONE     = 0x00008000,  /* An abort was performed for the SC */
-	SC_FL_SHUTW         = 0x00010000,  /* SC must shut down for writes ASAP */
+	SC_FL_SHUT_DONE     = 0x00010000,  /* A shutdown was performed for the SC */
 };
 
 /* This function is used to report flags in debugging tools. Please reflect
@@ -178,7 +178,7 @@
 	_(SC_FL_DONT_WAKE, _(SC_FL_INDEP_STR, _(SC_FL_WONT_READ,
 	_(SC_FL_NEED_BUFF, _(SC_FL_NEED_ROOM,
         _(SC_FL_RCV_ONCE, _(SC_FL_SND_ASAP, _(SC_FL_SND_NEVERWAIT, _(SC_FL_SND_EXP_MORE,
-	_(SC_FL_ABRT_WANTED, _(SC_FL_SHUT_WANTED, _(SC_FL_ABRT_DONE, _(SC_FL_SHUTW)))))))))))))))));
+	_(SC_FL_ABRT_WANTED, _(SC_FL_SHUT_WANTED, _(SC_FL_ABRT_DONE, _(SC_FL_SHUT_DONE)))))))))))))))));
 	/* epilogue */
 	_(~0U);
 	return buf;
diff --git a/src/activity.c b/src/activity.c
index 0e021b0..c47bd84 100644
--- a/src/activity.c
+++ b/src/activity.c
@@ -625,7 +625,7 @@
 	int i, j, max;
 
 	/* FIXME: Don't watch the other side ! */
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
 		return 1;
 
 	chunk_reset(&trash);
@@ -889,7 +889,7 @@
 	int i, max;
 
 	/* FIXME: Don't watch the other side ! */
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
 		return 1;
 
 	/* It's not possible to scan queues in small chunks and yield in the
@@ -1030,7 +1030,7 @@
 	int thr;
 
 	/* FIXME: Don't watch the other side ! */
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
 		return 1;
 
 	chunk_reset(&trash);
diff --git a/src/backend.c b/src/backend.c
index 885cec4..a221b1c 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1956,7 +1956,7 @@
 static int back_may_abort_req(struct channel *req, struct stream *s)
 {
 	return (sc_ep_test(s->scf, SE_FL_ERROR) ||
-	        ((chn_cons(req)->flags & (SC_FL_SHUT_WANTED|SC_FL_SHUTW)) &&  /* empty and client aborted */
+	        ((chn_cons(req)->flags & (SC_FL_SHUT_WANTED|SC_FL_SHUT_DONE)) &&  /* empty and client aborted */
 	         (channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE))));
 }
 
@@ -2246,7 +2246,7 @@
 	DBG_TRACE_ENTER(STRM_EV_STRM_PROC|STRM_EV_CS_ST, s);
 
 	/* the client might want to abort */
-	if ((chn_cons(rep)->flags & SC_FL_SHUTW) ||
+	if ((chn_cons(rep)->flags & SC_FL_SHUT_DONE) ||
 	    ((chn_cons(req)->flags & SC_FL_SHUT_WANTED) &&
 	     (channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) {
 		sc->flags |= SC_FL_NOLINGER;
@@ -2470,7 +2470,7 @@
 	 */
 	if (!(req->flags & CF_WROTE_DATA)) {
 		/* client abort ? */
-		if ((chn_cons(rep)->flags & SC_FL_SHUTW) ||
+		if ((chn_cons(rep)->flags & SC_FL_SHUT_DONE) ||
 		    ((chn_cons(req)->flags & SC_FL_SHUT_WANTED) &&
 		     (channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) {
 			/* give up */
diff --git a/src/channel.c b/src/channel.c
index 9d6f6e7..cebe307 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -206,8 +206,8 @@
 	max = len;
 
 	/* closed or empty + imminent close = -1; empty = 0 */
-	if (unlikely((chn_cons(chn)->flags & SC_FL_SHUTW) || channel_is_empty(chn))) {
-		if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+	if (unlikely((chn_cons(chn)->flags & SC_FL_SHUT_DONE) || channel_is_empty(chn))) {
+		if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
 			ret = -1;
 		goto out;
 	}
@@ -252,7 +252,7 @@
 	if (ret > 0 && ret < len &&
 	    (ret < co_data(chn) || channel_may_recv(chn)) &&
 	    !found &&
-	    !(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))
+	    !(chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)))
 		ret = 0;
  out:
 	if (max)
@@ -279,8 +279,8 @@
 	max = len;
 
 	/* closed or empty + imminent close = -1; empty = 0 */
-	if (unlikely((chn_cons(chn)->flags & SC_FL_SHUTW) || channel_is_empty(chn))) {
-		if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+	if (unlikely((chn_cons(chn)->flags & SC_FL_SHUT_DONE) || channel_is_empty(chn))) {
+		if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
 			ret = -1;
 		goto out;
 	}
@@ -303,7 +303,7 @@
 	if (ret > 0 && ret < len &&
 	    (ret < co_data(chn) || channel_may_recv(chn)) &&
 	    *(str-1) != sep &&
-	    !(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))
+	    !(chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)))
 		ret = 0;
  out:
 	if (max)
@@ -330,8 +330,8 @@
 	max = len;
 
 	/* closed or empty + imminent close = -1; empty = 0 */
-	if (unlikely((chn_cons(chn)->flags & SC_FL_SHUTW) || channel_is_empty(chn))) {
-		if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+	if (unlikely((chn_cons(chn)->flags & SC_FL_SHUT_DONE) || channel_is_empty(chn))) {
+		if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
 			ret = -1;
 		goto out;
 	}
@@ -354,7 +354,7 @@
 	if (ret > 0 && ret < len &&
 	    (ret < co_data(chn) || channel_may_recv(chn)) &&
 	    *(str-1) != '\n' &&
-	    !(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))
+	    !(chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)))
 		ret = 0;
  out:
 	if (max)
@@ -372,11 +372,11 @@
  */
 int co_getchar(const struct channel *chn, char *c)
 {
-	if (chn_cons(chn)->flags & SC_FL_SHUTW)
+	if (chn_cons(chn)->flags & SC_FL_SHUT_DONE)
 		return -1;
 
 	if (unlikely(co_data(chn) == 0)) {
-		if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+		if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
 			return -1;
 		return 0;
 	}
@@ -395,11 +395,11 @@
  */
 int co_getblk(const struct channel *chn, char *blk, int len, int offset)
 {
-	if (chn_cons(chn)->flags & SC_FL_SHUTW)
+	if (chn_cons(chn)->flags & SC_FL_SHUT_DONE)
 		return -1;
 
 	if (len + offset > co_data(chn) || co_data(chn) == 0) {
-		if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+		if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
 			return -1;
 		return 0;
 	}
@@ -418,7 +418,7 @@
 int co_getblk_nc(const struct channel *chn, const char **blk1, size_t *len1, const char **blk2, size_t *len2)
 {
 	if (unlikely(co_data(chn) == 0)) {
-		if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+		if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
 			return -1;
 		return 0;
 	}
@@ -460,7 +460,7 @@
 		}
 	}
 
-	if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) {
+	if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) {
 		/* If we have found no LF and the buffer is shut, then
 		 * the resulting string is made of the concatenation of
 		 * the pending blocks (1 or 2).
@@ -536,7 +536,7 @@
 		}
 	}
 
-	if (chn_cons(chn)->flags & SC_FL_SHUTW) {
+	if (chn_cons(chn)->flags & SC_FL_SHUT_DONE) {
 		/* If we have found no LF and the buffer is shut, then
 		 * the resulting string is made of the concatenation of
 		 * the pending blocks (1 or 2).
diff --git a/src/cli.c b/src/cli.c
index 840f775..55a825a 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -1216,7 +1216,7 @@
 	char **var = ctx->var;
 
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
 		return 1;
 
 	chunk_reset(&trash);
@@ -1255,7 +1255,7 @@
 	int ret = 1;
 
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
 		goto end;
 
 	chunk_reset(&trash);
@@ -2686,7 +2686,7 @@
 
 send_status:
 	s->pcli_flags |= PCLI_F_RELOAD;
-	/* dont' use ci_putblk here because SHUTW could have been sent */
+	/* dont' use ci_putblk here because SHUT_DONE could have been sent */
 	b_reset(&req->buf);
 	b_putblk(&req->buf, "_loadstatus;quit\n", 17);
 	goto read_again;
@@ -2716,7 +2716,7 @@
 	struct proxy *be = s->be;
 
 	if (sc_ep_test(s->scb, SE_FL_ERR_PENDING|SE_FL_ERROR) || (rep->flags & (CF_READ_TIMEOUT|CF_WRITE_TIMEOUT)) ||
-	    ((chn_cons(rep)->flags & SC_FL_SHUTW) && (rep->to_forward || co_data(rep)))) {
+	    ((chn_cons(rep)->flags & SC_FL_SHUT_DONE) && (rep->to_forward || co_data(rep)))) {
 		pcli_reply_and_close(s, "Can't connect to the target CLI!\n");
 		s->req.analysers &= ~AN_REQ_WAIT_CLI;
 		s->res.analysers &= ~AN_RES_WAIT_CLI;
@@ -2830,7 +2830,7 @@
 		sockaddr_free(&s->scb->dst);
 
 		sc_set_state(s->scb, SC_ST_INI);
-		s->scb->flags &= ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED);
+		s->scb->flags &= ~(SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED);
 		s->scb->flags &= SC_FL_ISBACK | SC_FL_DONT_WAKE; /* we're in the context of process_stream */
 
 		s->req.flags &= ~(CF_AUTO_CONNECT|CF_STREAMER|CF_STREAMER_FAST|CF_WROTE_DATA);
diff --git a/src/debug.c b/src/debug.c
index ed7f971..b02d92f 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -314,7 +314,7 @@
 	int thr;
 
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
 		return 1;
 
 	if (appctx->st0)
@@ -1162,7 +1162,7 @@
 	int i, fd;
 
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
 		goto end;
 
 	chunk_reset(&trash);
@@ -1370,7 +1370,7 @@
 	int ret = 1;
 
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
 		goto end;
 
 	if (!ctx->width) {
diff --git a/src/filters.c b/src/filters.c
index 23d0690..0c7fef1 100644
--- a/src/filters.c
+++ b/src/filters.c
@@ -1016,7 +1016,7 @@
 	 *  - the input in closed and no data is pending
 	 *  - There is a READ/WRITE timeout
 	 */
-	if (chn_cons(chn)->flags & SC_FL_SHUTW) {
+	if (chn_cons(chn)->flags & SC_FL_SHUT_DONE) {
 		ret = 1;
 		goto end;
 	}
diff --git a/src/http_ana.c b/src/http_ana.c
index e17075c..f9d71dd 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -983,7 +983,7 @@
 	if (!(txn->flags & TX_CON_WANT_TUN))
 		channel_dont_close(req);
 
-	if ((chn_cons(req)->flags & SC_FL_SHUTW) && co_data(req)) {
+	if ((chn_cons(req)->flags & SC_FL_SHUT_DONE) && co_data(req)) {
 		/* request errors are most likely due to the server aborting the
 		 * transfer. */
 		goto return_srv_abort;
@@ -1023,7 +1023,7 @@
 
  waiting:
 	/* waiting for the last bits to leave the buffer */
-	if (chn_cons(req)->flags & SC_FL_SHUTW)
+	if (chn_cons(req)->flags & SC_FL_SHUT_DONE)
 		goto return_srv_abort;
 
 	/* When TE: chunked is used, we need to get there again to parse remaining
@@ -1144,7 +1144,7 @@
 	res->analyse_exp = TICK_ETERNITY;
 	res->total = 0;
 
-	s->scb->flags &= ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED);
+	s->scb->flags &= ~(SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED);
 	if (sc_reset_endp(s->scb) < 0) {
 		if (!(s->flags & SF_ERR_MASK))
 			s->flags |= SF_ERR_INTERNAL;
@@ -1296,7 +1296,7 @@
 		/* 3: client abort with an abortonclose */
 		else if ((chn_prod(rep)->flags & SC_FL_ABRT_DONE) &&
 			 (chn_prod(&s->req)->flags & SC_FL_ABRT_DONE) &&
-			 (chn_cons(&s->req)->flags & SC_FL_SHUTW)) {
+			 (chn_cons(&s->req)->flags & SC_FL_SHUT_DONE)) {
 			_HA_ATOMIC_INC(&sess->fe->fe_counters.cli_aborts);
 			_HA_ATOMIC_INC(&s->be->be_counters.cli_aborts);
 			if (sess->listener && sess->listener->counters)
@@ -2104,7 +2104,7 @@
 
 	channel_dont_close(res);
 
-	if ((chn_cons(res)->flags & SC_FL_SHUTW) && co_data(res)) {
+	if ((chn_cons(res)->flags & SC_FL_SHUT_DONE) && co_data(res)) {
 		/* response errors are most likely due to the client aborting
 		 * the transfer. */
 		goto return_cli_abort;
@@ -2120,7 +2120,7 @@
 	return 0;
 
   missing_data_or_waiting:
-	if (chn_cons(res)->flags & SC_FL_SHUTW)
+	if (chn_cons(res)->flags & SC_FL_SHUT_DONE)
 		goto return_cli_abort;
 
 	/* stop waiting for data if the input is closed before the end. If the
@@ -2130,7 +2130,7 @@
 	 */
 	if (msg->msg_state < HTTP_MSG_ENDING && (chn_prod(res)->flags & SC_FL_ABRT_DONE)) {
 		if ((chn_prod(&s->req)->flags & SC_FL_ABRT_DONE) &&
-		    (chn_cons(&s->req)->flags & SC_FL_SHUTW))
+		    (chn_cons(&s->req)->flags & SC_FL_SHUT_DONE))
 			goto return_cli_abort;
 		/* If we have some pending data, we continue the processing */
 		if (htx_is_empty(htx))
@@ -4272,7 +4272,7 @@
 			    txn->rsp.msg_state != HTTP_MSG_CLOSED)
 				goto check_channel_flags;
 
-			if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))) {
+			if (!(chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))) {
 				sc_schedule_abort(s->scf);
 				sc_schedule_shutdown(s->scb);
 			}
@@ -4306,7 +4306,7 @@
 
   check_channel_flags:
 	/* Here, we are in HTTP_MSG_DONE or HTTP_MSG_TUNNEL */
-	if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) {
+	if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) {
 		/* if we've just closed an output, let's switch */
 		txn->req.msg_state = HTTP_MSG_CLOSING;
 		goto http_msg_closing;
@@ -4371,7 +4371,7 @@
 			/* we're not expecting any new data to come for this
 			 * transaction, so we can close it.
 			 */
-			if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))) {
+			if (!(chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))) {
 				sc_schedule_abort(s->scb);
 				sc_schedule_shutdown(s->scf);
 			}
@@ -4402,7 +4402,7 @@
 
   check_channel_flags:
 	/* Here, we are in HTTP_MSG_DONE or HTTP_MSG_TUNNEL */
-	if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) {
+	if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) {
 		/* if we've just closed an output, let's switch */
 		txn->rsp.msg_state = HTTP_MSG_CLOSING;
 		goto http_msg_closing;
diff --git a/src/map.c b/src/map.c
index b7e087b..fe694b5 100644
--- a/src/map.c
+++ b/src/map.c
@@ -349,7 +349,7 @@
 	struct pat_ref_elt *elt;
 
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW)) {
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE)) {
 		/* 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 7b4f09c..11d61a2 100644
--- a/src/mworker.c
+++ b/src/mworker.c
@@ -568,7 +568,7 @@
 	char *reloadtxt = NULL;
 
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
 		return 1;
 
 	if (up < 0) /* must never be negative because of clock drift */
@@ -715,7 +715,7 @@
 		return 1;
 
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
 		return 1;
 
 	env = getenv("HAPROXY_LOAD_SUCCESS");
diff --git a/src/proxy.c b/src/proxy.c
index a025e18..f2eb6a8 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -3255,7 +3255,7 @@
 	extern const char *monthname[12];
 
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
 		return 1;
 
 	chunk_reset(&trash);
diff --git a/src/quic_conn.c b/src/quic_conn.c
index 5c1d64e..9ede4df 100644
--- a/src/quic_conn.c
+++ b/src/quic_conn.c
@@ -8350,7 +8350,7 @@
 		goto done;
 
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW)) {
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE)) {
 		/* If we're forced to shut down, we might have to remove our
 		 * reference to the last stream being dumped.
 		 */
diff --git a/src/ring.c b/src/ring.c
index fbd2d06..7aa5185 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -350,7 +350,7 @@
 	int ret;
 
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
 		return 1;
 
 	HA_RWLOCK_WRLOCK(LOGSRV_LOCK, &ring->lock);
@@ -423,7 +423,7 @@
 		/* we've drained everything and are configured to wait for more
 		 * data or an event (keypress, close)
 		 */
-		if (!sc_oc(sc)->output && !(sc->flags & SC_FL_SHUTW)) {
+		if (!sc_oc(sc)->output && !(sc->flags & SC_FL_SHUT_DONE)) {
 			/* let's be woken up once new data arrive */
 			HA_RWLOCK_WRLOCK(LOGSRV_LOCK, &ring->lock);
 			LIST_APPEND(&ring->waiters, &appctx->wait_entry);
diff --git a/src/ssl_ckch.c b/src/ssl_ckch.c
index 5b3a20d..51bd162 100644
--- a/src/ssl_ckch.c
+++ b/src/ssl_ckch.c
@@ -2149,7 +2149,7 @@
 	struct ckch_inst *ckchi;
 
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
 		goto end;
 
 	while (1) {
@@ -2826,7 +2826,7 @@
 	char *path;
 
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
 		goto end;
 
 	/* The ctx was already validated by the ca-file/crl-file parsing
diff --git a/src/ssl_crtlist.c b/src/ssl_crtlist.c
index f74f43a..5296118 100644
--- a/src/ssl_crtlist.c
+++ b/src/ssl_crtlist.c
@@ -1117,7 +1117,7 @@
 	 * created.
 	 */
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
 		goto end;
 
 	switch (ctx->state) {
diff --git a/src/stconn.c b/src/stconn.c
index 64163d5..afe5d7b 100644
--- a/src/stconn.c
+++ b/src/stconn.c
@@ -544,7 +544,7 @@
 	if (!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
 		return;
 
-	if (sc->flags & SC_FL_SHUTW) {
+	if (sc->flags & SC_FL_SHUT_DONE) {
 		sc->state = SC_ST_DIS;
 		if (sc->flags & SC_FL_ISBACK)
 			__sc_strm(sc)->conn_exp = TICK_ETERNITY;
@@ -570,9 +570,9 @@
 	struct channel *oc = sc_oc(sc);
 
 	sc->flags &= ~SC_FL_SHUT_WANTED;
-	if (sc->flags & SC_FL_SHUTW)
+	if (sc->flags & SC_FL_SHUT_DONE)
 		return;
-	sc->flags |= SC_FL_SHUTW;
+	sc->flags |= SC_FL_SHUT_DONE;
 	oc->flags |= CF_WRITE_EVENT;
 	sc_set_hcto(sc);
 
@@ -630,7 +630,7 @@
 {
 	struct channel *oc = sc_oc(sc);
 
-	if (unlikely(sc->state != SC_ST_EST || (sc->flags & SC_FL_SHUTW)))
+	if (unlikely(sc->state != SC_ST_EST || (sc->flags & SC_FL_SHUT_DONE)))
 		return;
 
 	if (!sc_ep_test(sc, SE_FL_WAIT_DATA) ||  /* not waiting for data */
@@ -669,7 +669,7 @@
 	if (!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
 		return;
 
-	if (sc->flags & SC_FL_SHUTW) {
+	if (sc->flags & SC_FL_SHUT_DONE) {
 		sc_conn_shut(sc);
 		sc->state = SC_ST_DIS;
 		if (sc->flags & SC_FL_ISBACK)
@@ -695,9 +695,9 @@
 	BUG_ON(!sc_conn(sc));
 
 	sc->flags &= ~SC_FL_SHUT_WANTED;
-	if (sc->flags & SC_FL_SHUTW)
+	if (sc->flags & SC_FL_SHUT_DONE)
 		return;
-	sc->flags |= SC_FL_SHUTW;
+	sc->flags |= SC_FL_SHUT_DONE;
 	oc->flags |= CF_WRITE_EVENT;
 	sc_set_hcto(sc);
 
@@ -783,7 +783,7 @@
 	BUG_ON(!sc_conn(sc));
 
 	if (unlikely(!sc_state_in(sc->state, SC_SB_RDY|SC_SB_EST) ||
-		     (sc->flags & SC_FL_SHUTW)))
+		     (sc->flags & SC_FL_SHUT_DONE)))
 		return;
 
 	if (unlikely(channel_is_empty(oc)))  /* called with nothing to send ! */
@@ -813,13 +813,13 @@
 		 * chunk and need to close.
 		 */
 		if ((oc->flags & CF_AUTO_CLOSE) &&
-		    ((sc->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED) &&
+		    ((sc->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED) &&
 		    sc_state_in(sc->state, SC_SB_RDY|SC_SB_EST)) {
 			sc_shutw(sc);
 			goto out_wakeup;
 		}
 
-		if ((sc->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) == 0)
+		if ((sc->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) == 0)
 			sc_ep_set(sc, SE_FL_WAIT_DATA);
 	}
 	else {
@@ -832,7 +832,7 @@
 	/* in case of special condition (error, shutdown, end of write...), we
 	 * have to notify the task.
 	 */
-	if (likely((sc->flags & SC_FL_SHUTW) ||
+	if (likely((sc->flags & SC_FL_SHUT_DONE) ||
 		   ((oc->flags & CF_WRITE_EVENT) && sc->state < SC_ST_EST) ||
 		   ((oc->flags & CF_WAKE_WRITE) &&
 		    ((channel_is_empty(oc) && !oc->to_forward) ||
@@ -867,7 +867,7 @@
 	if (!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
 		return;
 
-	if (sc->flags & SC_FL_SHUTW) {
+	if (sc->flags & SC_FL_SHUT_DONE) {
 		appctx_shut(__sc_appctx(sc));
 		sc->state = SC_ST_DIS;
 		if (sc->flags & SC_FL_ISBACK)
@@ -892,9 +892,9 @@
 	BUG_ON(!sc_appctx(sc));
 
 	sc->flags &= ~SC_FL_SHUT_WANTED;
-	if (sc->flags & SC_FL_SHUTW)
+	if (sc->flags & SC_FL_SHUT_DONE)
 		return;
-	sc->flags |= SC_FL_SHUTW;
+	sc->flags |= SC_FL_SHUT_DONE;
 	oc->flags |= CF_WRITE_EVENT;
 	sc_set_hcto(sc);
 
@@ -952,7 +952,7 @@
 
 	BUG_ON(!sc_appctx(sc));
 
-	if (unlikely(sc->state != SC_ST_EST || (sc->flags & SC_FL_SHUTW)))
+	if (unlikely(sc->state != SC_ST_EST || (sc->flags & SC_FL_SHUT_DONE)))
 		return;
 
 	/* we only wake the applet up if it was waiting for some data  and is ready to consume it */
@@ -1004,7 +1004,7 @@
 {
 	struct channel *oc = sc_oc(sc);
 
-	if (sc->flags & SC_FL_SHUTW)
+	if (sc->flags & SC_FL_SHUT_DONE)
 		return;
 
 	/* Write not closed, update FD status and timeout for writes */
@@ -1042,7 +1042,7 @@
 	if (channel_is_empty(oc)) {
 		struct connection *conn = sc_conn(sc);
 
-		if (((sc->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED) &&
+		if (((sc->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED) &&
 		    (sc->state == SC_ST_EST) && (!conn || !(conn->flags & (CO_FL_WAIT_XPRT | CO_FL_EARLY_SSL_HS))))
 			sc_shutw(sc);
 	}
@@ -1050,9 +1050,9 @@
 	/* indicate that we may be waiting for data from the output channel or
 	 * we're about to close and can't expect more data if SC_FL_SHUT_WANTED is there.
 	 */
-	if (!(sc->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))
+	if (!(sc->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)))
 		sc_ep_set(sc, SE_FL_WAIT_DATA);
-	else if ((sc->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED)
+	else if ((sc->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED)
 		sc_ep_clr(sc, SE_FL_WAIT_DATA);
 
 	if (oc->flags & CF_DONT_READ)
@@ -1115,10 +1115,10 @@
 	    sc_ep_test(sc, SE_FL_ERR_PENDING) ||
 	    ((oc->flags & CF_WRITE_EVENT) &&
 	     ((sc->state < SC_ST_EST) ||
-	      (sc->flags & SC_FL_SHUTW) ||
+	      (sc->flags & SC_FL_SHUT_DONE) ||
 	      (((oc->flags & CF_WAKE_WRITE) ||
 		(!(oc->flags & CF_AUTO_CLOSE) &&
-		 !(sc->flags & (SC_FL_SHUT_WANTED|SC_FL_SHUTW)))) &&
+		 !(sc->flags & (SC_FL_SHUT_WANTED|SC_FL_SHUT_DONE)))) &&
 	       (sco->state != SC_ST_EST ||
 		(channel_is_empty(oc) && !oc->to_forward)))))) {
 		task_wakeup(task, TASK_WOKEN_IO);
@@ -1148,7 +1148,7 @@
 	if (!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
 		return;
 
-	if (sc->flags & SC_FL_SHUTW)
+	if (sc->flags & SC_FL_SHUT_DONE)
 		goto do_close;
 
 	if (sc_cond_forward_shutw(sc)) {
@@ -1166,7 +1166,7 @@
 	sc_conn_shut(sc);
 
 	sc->flags &= ~SC_FL_SHUT_WANTED;
-	sc->flags |= SC_FL_SHUTW;
+	sc->flags |= SC_FL_SHUT_DONE;
 
 	sc->state = SC_ST_DIS;
 	if (sc->flags & SC_FL_ISBACK)
@@ -1369,7 +1369,7 @@
 		cur_read += ret;
 
 		/* if we're allowed to directly forward data, we must update ->o */
-		if (ic->to_forward && !(chn_cons(ic)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))) {
+		if (ic->to_forward && !(chn_cons(ic)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))) {
 			unsigned long fwd = ret;
 			if (ic->to_forward != CHN_INFINITE_FORWARD) {
 				if (fwd > ic->to_forward)
@@ -1564,7 +1564,7 @@
 		return 0;
 
 	/* we might have been called just after an asynchronous shutw */
-	if (sc->flags & SC_FL_SHUTW)
+	if (sc->flags & SC_FL_SHUT_DONE)
 		return 1;
 
 	/* we must wait because the mux is not installed yet */
@@ -1696,7 +1696,7 @@
 
 	oc->flags &= ~CF_WRITE_EVENT;
 
-	if (sc->flags & SC_FL_SHUTW)
+	if (sc->flags & SC_FL_SHUT_DONE)
 		return;
 
 	if (channel_is_empty(oc))
diff --git a/src/stick_table.c b/src/stick_table.c
index 1f46795..a2aa9c4 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -5047,7 +5047,7 @@
 	 *     data though.
 	 */
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW)) {
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE)) {
 		/* 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 f455b32..59049b8 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -954,7 +954,7 @@
 	}
 	/* 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 ((s->scb->flags & SC_FL_ABRT_DONE) || (s->scf->flags & SC_FL_SHUTW)) {
+	if ((s->scb->flags & SC_FL_ABRT_DONE) || (s->scf->flags & SC_FL_SHUT_DONE)) {
 		s->scb->state = SC_ST_DIS;
 		DBG_TRACE_STATE("response channel shutdwn for read/write", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s);
 	}
@@ -1585,7 +1585,7 @@
 	sc_check_timeouts(s->scb);
 	channel_check_timeout(&s->res);
 
-	if (unlikely(!(s->scb->flags & SC_FL_SHUTW) && (s->req.flags & CF_WRITE_TIMEOUT))) {
+	if (unlikely(!(s->scb->flags & SC_FL_SHUT_DONE) && (s->req.flags & CF_WRITE_TIMEOUT))) {
 		s->scb->flags |= SC_FL_NOLINGER;
 		sc_shutw(s->scb);
 	}
@@ -1595,7 +1595,7 @@
 			s->scf->flags |= SC_FL_NOLINGER;
 		sc_abort(s->scf);
 	}
-	if (unlikely(!(s->scf->flags & SC_FL_SHUTW) && (s->res.flags & CF_WRITE_TIMEOUT))) {
+	if (unlikely(!(s->scf->flags & SC_FL_SHUT_DONE) && (s->res.flags & CF_WRITE_TIMEOUT))) {
 		s->scf->flags |= SC_FL_NOLINGER;
 		sc_shutw(s->scf);
 	}
@@ -1783,7 +1783,7 @@
 		 * So let's not run a whole stream processing if only an expiration
 		 * timeout needs to be refreshed.
 		 */
-		if (!((scf->flags | scb->flags) & (SC_FL_ABRT_DONE|SC_FL_SHUTW)) &&
+		if (!((scf->flags | scb->flags) & (SC_FL_ABRT_DONE|SC_FL_SHUT_DONE)) &&
 		    !((req->flags | res->flags) & (CF_READ_EVENT|CF_READ_TIMEOUT|CF_WRITE_EVENT|CF_WRITE_TIMEOUT)) &&
 		    !(s->flags & SF_CONN_EXP) &&
 		    !((sc_ep_get(scf) | sc_ep_get(scb)) & SE_FL_ERROR) &&
@@ -1955,8 +1955,8 @@
 	/* Analyse request */
 	if (((req->flags & ~rqf_last) & CF_MASK_ANALYSER) ||
 	    ((scf->flags ^ scf_flags) & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) ||
-	    ((scb->flags ^ scb_flags) & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) ||
-	    (req->analysers && (chn_cons(req)->flags & SC_FL_SHUTW)) ||
+	    ((scb->flags ^ scb_flags) & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) ||
+	    (req->analysers && (chn_cons(req)->flags & SC_FL_SHUT_DONE)) ||
 	    scf->state != rq_prod_last ||
 	    scb->state != rq_cons_last ||
 	    s->pending_events & TASK_WOKEN_MSG) {
@@ -2043,9 +2043,9 @@
 		req->flags &= ~CF_WAKE_ONCE;
 		rqf_last = req->flags;
 		scf_flags = (scf_flags & ~(SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) | (scf->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED));
-		scb_flags = (scb_flags & ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED)) | (scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED));
+		scb_flags = (scb_flags & ~(SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) | (scb->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED));
 
-		if (((scf->flags ^ scf_flags_ana) & SC_FL_ABRT_DONE) || ((scb->flags ^ scb_flags_ana) & SC_FL_SHUTW))
+		if (((scf->flags ^ scf_flags_ana) & SC_FL_ABRT_DONE) || ((scb->flags ^ scb_flags_ana) & SC_FL_SHUT_DONE))
 			goto resync_request;
 	}
 
@@ -2060,8 +2060,8 @@
 
 	if (((res->flags & ~rpf_last) & CF_MASK_ANALYSER) ||
 	    ((scb->flags ^ scb_flags) & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) ||
-	    ((scf->flags ^ scf_flags) & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) ||
-	    (res->analysers && (chn_cons(res)->flags & SC_FL_SHUTW)) ||
+	    ((scf->flags ^ scf_flags) & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) ||
+	    (res->analysers && (chn_cons(res)->flags & SC_FL_SHUT_DONE)) ||
 	    scf->state != rp_cons_last ||
 	    scb->state != rp_prod_last ||
 	    s->pending_events & TASK_WOKEN_MSG) {
@@ -2116,9 +2116,9 @@
 		res->flags &= ~CF_WAKE_ONCE;
 		rpf_last = res->flags;
 		scb_flags = (scb_flags & ~(SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) | (scb->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED));
-		scf_flags = (scf_flags & ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED)) | (scf->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED));
+		scf_flags = (scf_flags & ~(SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) | (scf->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED));
 
-		if (((scb->flags ^ scb_flags_ana) & SC_FL_ABRT_DONE) || ((scf->flags ^ scf_flags_ana) & SC_FL_SHUTW))
+		if (((scb->flags ^ scb_flags_ana) & SC_FL_ABRT_DONE) || ((scf->flags ^ scf_flags_ana) & SC_FL_SHUT_DONE))
 			goto resync_response;
 	}
 
@@ -2232,7 +2232,7 @@
 	 * recent call to channel_abort().
 	 */
 	if (unlikely((!req->analysers || (req->analysers == AN_REQ_FLT_END && !(req->flags & CF_FLT_ANALYZE))) &&
-		     !(scf->flags & SC_FL_ABRT_WANTED) && !(scb->flags & SC_FL_SHUTW) &&
+		     !(scf->flags & SC_FL_ABRT_WANTED) && !(scb->flags & SC_FL_SHUT_DONE) &&
 		     (sc_state_in(scf->state, SC_SB_EST|SC_SB_DIS|SC_SB_CLO)) &&
 		     (req->to_forward != CHN_INFINITE_FORWARD))) {
 		/* This buffer is freewheeling, there's no analyser
@@ -2284,7 +2284,7 @@
 	/* reflect what the L7 analysers have seen last */
 	rqf_last = req->flags;
 	scf_flags = (scf_flags & ~(SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) | (scf->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED));
-	scb_flags = (scb_flags & ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED)) | (scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED));
+	scb_flags = (scb_flags & ~(SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) | (scb->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED));
 
 	/* it's possible that an upper layer has requested a connection setup or abort.
 	 * There are 2 situations where we decide to establish a new connection :
@@ -2292,7 +2292,7 @@
 	 *  - the CF_AUTO_CONNECT flag is set (active connection)
 	 */
 	if (scb->state == SC_ST_INI) {
-		if (!(scb->flags & SC_FL_SHUTW)) {
+		if (!(scb->flags & SC_FL_SHUT_DONE)) {
 			if ((req->flags & CF_AUTO_CONNECT) || !channel_is_empty(req)) {
 				/* If we have an appctx, there is no connect method, so we
 				 * immediately switch to the connected state, otherwise we
@@ -2365,13 +2365,13 @@
 	 * connection setup unless the backend has abortonclose set.
 	 */
 	if (unlikely((req->flags & CF_AUTO_CLOSE) && (scf->flags & SC_FL_ABRT_DONE) &&
-		     !(scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) &&
+		     !(scb->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) &&
 		     (scb->state != SC_ST_CON || (s->be->options & PR_O_ABRT_CLOSE)))) {
 		sc_schedule_shutdown(scb);
 	}
 
 	/* shutdown(write) pending */
-	if (unlikely((scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED &&
+	if (unlikely((scb->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED &&
 		     channel_is_empty(req))) {
 		if (sc_ep_test(s->scf, SE_FL_ERROR))
 			scb->flags |= SC_FL_NOLINGER;
@@ -2379,7 +2379,7 @@
 	}
 
 	/* shutdown(write) done on server side, we must stop the client too */
-	if (unlikely((scb->flags & SC_FL_SHUTW) && !(scf->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED))) &&
+	if (unlikely((scb->flags & SC_FL_SHUT_DONE) && !(scf->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED))) &&
 	    !req->analysers)
 		sc_schedule_abort(scf);
 
@@ -2398,7 +2398,7 @@
 		goto resync_stconns;
 
 	/* otherwise we want to check if we need to resync the req buffer or not */
-	if (((scf->flags ^ scf_flags) & SC_FL_ABRT_DONE) || ((scb->flags ^ scb_flags) & SC_FL_SHUTW))
+	if (((scf->flags ^ scf_flags) & SC_FL_ABRT_DONE) || ((scb->flags ^ scb_flags) & SC_FL_SHUT_DONE))
 		goto resync_request;
 
 	/* perform output updates to the response buffer */
@@ -2447,9 +2447,9 @@
 		if (!req->analysers && s->tunnel_timeout) {
 			scf->ioto = scb->ioto = s->tunnel_timeout;
 
-			if ((scf->flags & (SC_FL_ABRT_DONE|SC_FL_SHUTW)) && tick_isset(sess->fe->timeout.clientfin))
+			if ((scf->flags & (SC_FL_ABRT_DONE|SC_FL_SHUT_DONE)) && tick_isset(sess->fe->timeout.clientfin))
 				scf->ioto = sess->fe->timeout.clientfin;
-			if ((scb->flags & (SC_FL_ABRT_DONE|SC_FL_SHUTW)) && tick_isset(s->be->timeout.serverfin))
+			if ((scb->flags & (SC_FL_ABRT_DONE|SC_FL_SHUT_DONE)) && tick_isset(s->be->timeout.serverfin))
 				scb->ioto = s->be->timeout.serverfin;
 		}
 	}
@@ -2473,7 +2473,7 @@
 	/* reflect what the L7 analysers have seen last */
 	rpf_last = res->flags;
 	scb_flags = (scb_flags & ~(SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) | (scb->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED));
-	scf_flags = (scf_flags & ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED)) | (scf->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED));
+	scf_flags = (scf_flags & ~(SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) | (scf->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED));
 
 	/* Let's see if we can send the pending response now */
 	sc_conn_sync_send(scf);
@@ -2488,18 +2488,18 @@
 
 	/* first, let's check if the response buffer needs to shutdown(write) */
 	if (unlikely((res->flags & CF_AUTO_CLOSE) && (scb->flags & SC_FL_ABRT_DONE) &&
-		     !(scf->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))) {
+		     !(scf->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)))) {
 		sc_schedule_shutdown(scf);
 	}
 
 	/* shutdown(write) pending */
-	if (unlikely((scf->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED &&
+	if (unlikely((scf->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED &&
 		     channel_is_empty(res))) {
 		sc_shutw(scf);
 	}
 
 	/* shutdown(write) done on the client side, we must stop the server too */
-	if (unlikely((scf->flags & SC_FL_SHUTW) && !(scb->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED))) &&
+	if (unlikely((scf->flags & SC_FL_SHUT_DONE) && !(scb->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED))) &&
 	    !res->analysers)
 		sc_schedule_abort(scb);
 
@@ -2520,7 +2520,7 @@
 		goto resync_request;
 
 	if (((scb->flags ^ scb_flags) & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) ||
-	    ((scf->flags ^ scf_flags) & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))
+	    ((scf->flags ^ scf_flags) & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)))
 		goto resync_response;
 
 	if (((req->flags ^ rqf_last) | (res->flags ^ rpf_last)) & CF_MASK_ANALYSER)
@@ -2778,7 +2778,7 @@
 /* kill a stream and set the termination flags to <why> (one of SF_ERR_*) */
 void stream_shutdown(struct stream *stream, int why)
 {
-	if (stream->scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+	if (stream->scb->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
 		return;
 
 	sc_schedule_shutdown(stream->scb);
@@ -3603,7 +3603,7 @@
 	}
 
 	/* FIXME: Don't watch the other side !*/
-	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW)) {
+	if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE)) {
 		/* If we're forced to shut down, we might have to remove our
 		 * reference to the last stream being dumped.
 		 */