MEDIUM: connection: replace conn_full_close() with cs_close()

At all call places where a conn_stream is in use, we can now use
cs_close() to get rid of a conn_stream and of its underlying connection
if the mux estimates it makes sense. This is what is currently being
done for the pass-through mux.
diff --git a/src/checks.c b/src/checks.c
index ee0458d..49d9467 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -1400,7 +1400,7 @@
 		 * sure want to abort the hard way.
 		 */
 		conn_sock_drain(conn);
-		conn_full_close(conn);
+		cs_close(cs);
 		ret = -1;
 	}
 
@@ -2207,7 +2207,7 @@
 			 * server state to be suddenly changed.
 			 */
 			conn_sock_drain(conn);
-			conn_full_close(conn);
+			cs_close(cs);
 		}
 
 		if (conn) {
@@ -2686,9 +2686,8 @@
 			 *   3: release and replace the old one on success
 			 */
 			if (check->cs) {
-				/* XXX: need to kill all CS here as well but not to free them yet */
-				conn_full_close(check->cs->conn);
-				retcode = -1; /* do not reuse the fd! */
+				cs_close(check->cs);
+				retcode = -1; /* do not reuse the fd in the caller! */
 			}
 
 			/* mark the step as started */
diff --git a/src/stream.c b/src/stream.c
index 722d2f4..d347f47 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -579,7 +579,7 @@
 	struct stream_interface *si = &s->si[1];
 	struct channel *req = &s->req;
 	struct channel *rep = &s->res;
-	struct connection *srv_conn = __objt_cs(si->end)->conn;
+	struct conn_stream *srv_cs = __objt_cs(si->end);
 
 	/* If we got an error, or if nothing happened and the connection timed
 	 * out, we must give up. The CER state handler will take care of retry
@@ -602,7 +602,7 @@
 		/* XXX cognet: do we really want to kill the connection here ?
 		 * Probably not for multiple streams.
 		 */
-		conn_full_close(srv_conn);
+		cs_close(srv_cs);
 
 		if (si->err_type)
 			return 0;
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 9353d08..2c48b03 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -821,8 +821,7 @@
 		return;
 
 	if (si_oc(si)->flags & CF_SHUTW) {
-		/* XXX: should just close cs ? */
-		conn_full_close(conn);
+		cs_close(cs);
 		si->state = SI_ST_DIS;
 		si->exp = TICK_ETERNITY;
 	}
@@ -890,22 +889,13 @@
 			 * layer to try to signal it to the peer before we close.
 			 */
 			cs_shutw(cs, CS_SHW_NORMAL);
-			conn_sock_shutw(conn);
 
-			/* If the stream interface is configured to disable half-open
-			 * connections, we'll skip the shutdown(), but only if the
-			 * read size is already closed. Otherwise we can't support
-			 * closed write with pending read (eg: abortonclose while
-			 * waiting for the server).
-			 */
-			if (!(si->flags & SI_FL_NOHALF) || !(ic->flags & (CF_SHUTR|CF_DONT_READ))) {
-				if (!(ic->flags & (CF_SHUTR|CF_DONT_READ))) {
-					/* OK just a shutw, but we want the caller
-					 * to disable polling on this FD if exists.
-					 */
-					conn_cond_update_polling(conn);
-					return;
-				}
+			if (!(ic->flags & (CF_SHUTR|CF_DONT_READ))) {
+				/* OK just a shutw, but we want the caller
+				 * to disable polling on this FD if exists.
+				 */
+				conn_cond_update_polling(conn);
+				return;
 			}
 		}
 
@@ -914,7 +904,7 @@
 		/* we may have to close a pending connection, and mark the
 		 * response buffer as shutr
 		 */
-		conn_full_close(conn);
+		cs_close(cs);
 		/* fall through */
 	case SI_ST_CER:
 	case SI_ST_QUE:
@@ -1369,11 +1359,7 @@
 
  do_close:
 	/* OK we completely close the socket here just as if we went through si_shut[rw]() */
-	conn_full_close(cs->conn);
-
-	ic->flags &= ~CF_SHUTR_NOW;
-	ic->flags |= CF_SHUTR;
-	ic->rex = TICK_ETERNITY;
+	cs_close(cs);
 
 	oc->flags &= ~CF_SHUTW_NOW;
 	oc->flags |= CF_SHUTW;