MINOR: conn_stream: modify cs_shut{r,w} API to pass the desired mode

Now we can specify how we want to shutdown (drain vs reset, and normal
vs silent), and this propagates to the mux then the transport layer.
diff --git a/include/proto/connection.h b/include/proto/connection.h
index e55ec8b..1ce0b05 100644
--- a/include/proto/connection.h
+++ b/include/proto/connection.h
@@ -537,45 +537,28 @@
 		c->xprt->shutw(c, 0);
 }
 
-/* shut read after draining possibly pending data */
-static inline void cs_shutr(struct conn_stream *cs)
+/* shut read */
+static inline void cs_shutr(struct conn_stream *cs, enum cs_shr_mode mode)
 {
 	__cs_stop_recv(cs);
 
 	/* clean data-layer shutdown */
 	if (cs->conn->mux && cs->conn->mux->shutr)
-		cs->conn->mux->shutr(cs, 1);
+		cs->conn->mux->shutr(cs, mode);
+	cs->flags |= (mode == CS_SHR_DRAIN) ? CS_FL_SHRD : CS_FL_SHRR;
 }
 
-/* shut read after disabling lingering */
-static inline void cs_shutr_hard(struct conn_stream *cs)
-{
-	__cs_stop_recv(cs);
-
-	/* clean data-layer shutdown */
-	if (cs->conn->mux && cs->conn->mux->shutr)
-		cs->conn->mux->shutr(cs, 0);
-}
-
-static inline void cs_shutw(struct conn_stream *cs)
+/* shut write */
+static inline void cs_shutw(struct conn_stream *cs, enum cs_shw_mode mode)
 {
 	__cs_stop_send(cs);
 
 	/* clean data-layer shutdown */
 	if (cs->conn->mux && cs->conn->mux->shutw)
-		cs->conn->mux->shutw(cs, 1);
+		cs->conn->mux->shutw(cs, mode);
+	cs->flags |= (mode == CS_SHW_NORMAL) ? CS_FL_SHWN : CS_FL_SHWS;
 }
 
-static inline void cs_shutw_hard(struct conn_stream *cs)
-{
-	__cs_stop_send(cs);
-
-	/* unclean data-layer shutdown */
-	if (cs->conn->mux && cs->conn->mux->shutw)
-		cs->conn->mux->shutw(cs, 0);
-}
-
-
 /* detect sock->data read0 transition */
 static inline int conn_xprt_read0_pending(struct connection *c)
 {
diff --git a/include/types/connection.h b/include/types/connection.h
index 1b3e73a..ff9868e 100644
--- a/include/types/connection.h
+++ b/include/types/connection.h
@@ -292,8 +292,8 @@
 	int  (*snd_buf)(struct conn_stream *cs, struct buffer *buf, int flags); /* Called from the upper layer to send data */
 	int  (*rcv_pipe)(struct conn_stream *cs, struct pipe *pipe, unsigned int count); /* recv-to-pipe callback */
 	int  (*snd_pipe)(struct conn_stream *cs, struct pipe *pipe); /* send-to-pipe callback */
-	void (*shutr)(struct conn_stream *cs, int clean); /* shutr function */
-	void (*shutw)(struct conn_stream *cs, int clean); /* shutw function */
+	void (*shutr)(struct conn_stream *cs, enum cs_shr_mode);     /* shutr function */
+	void (*shutw)(struct conn_stream *cs, enum cs_shw_mode);     /* shutw function */
 
 	void (*release)(struct connection *conn);     /* release all resources allocated by the mux */
 	struct conn_stream *(*attach)(struct connection *); /* Create and attach a conn_stream to an outgoing connection */
diff --git a/src/checks.c b/src/checks.c
index 57468e0..ee0458d 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -1344,7 +1344,7 @@
 	 * drain pending data.
 	 */
 	__cs_stop_both(cs);
-	cs_shutw(cs);
+	cs_shutw(cs, CS_SHW_NORMAL);
 
 	/* OK, let's not stay here forever */
 	if (check->result == CHK_RES_FAILED)
diff --git a/src/mux_pt.c b/src/mux_pt.c
index 9438d64..e5d3dff 100644
--- a/src/mux_pt.c
+++ b/src/mux_pt.c
@@ -120,16 +120,16 @@
 {
 }
 
-static void mux_pt_shutr(struct conn_stream *cs, int clean)
+static void mux_pt_shutr(struct conn_stream *cs, enum cs_shr_mode mode)
 {
 	if (conn_xprt_ready(cs->conn) && cs->conn->xprt->shutr)
-		cs->conn->xprt->shutr(cs->conn, clean);
+		cs->conn->xprt->shutr(cs->conn, (mode == CS_SHR_DRAIN));
 }
 
-static void mux_pt_shutw(struct conn_stream *cs, int clean)
+static void mux_pt_shutw(struct conn_stream *cs, enum cs_shw_mode mode)
 {
 	if (conn_xprt_ready(cs->conn) && cs->conn->xprt->shutw)
-		cs->conn->xprt->shutw(cs->conn, clean);
+		cs->conn->xprt->shutw(cs->conn, (mode == CS_SHW_NORMAL));
 }
 
 /*
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 5b04b8e..42656ca 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -880,7 +880,7 @@
 			 * option abortonclose. No need for the TLS layer to try to
 			 * emit a shutdown message.
 			 */
-			cs_shutw_hard(cs);
+			cs_shutw(cs, CS_SHW_SILENT);
 		}
 		else {
 			/* clean data-layer shutdown. This only happens on the
@@ -889,7 +889,7 @@
 			 * while option abortonclose is set. We want the TLS
 			 * layer to try to signal it to the peer before we close.
 			 */
-			cs_shutw(cs);
+			cs_shutw(cs, CS_SHW_NORMAL);
 
 			/* If the stream interface is configured to disable half-open
 			 * connections, we'll skip the shutdown(), but only if the
@@ -1358,7 +1358,7 @@
 	if (si->flags & SI_FL_NOHALF) {
 		/* we want to immediately forward this close to the write side */
 		/* force flag on ssl to keep stream in cache */
-		cs_shutw_hard(cs);
+		cs_shutw(cs, CS_SHW_SILENT);
 		goto do_close;
 	}