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)
{
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 */
* 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)
{
}
-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));
}
/*
* 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
* 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
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;
}