#define H1C_F_IN_ALLOC 0x00000010 /* mux is blocked on lack of input buffer */
#define H1C_F_IN_FULL 0x00000020 /* mux is blocked on input buffer full */
#define H1C_F_IN_BUSY 0x00000040 /* mux is blocked on input waiting the other side */
-/* 0x00000040 - 0x00000800 unused */
+/* 0x00000080 - 0x000002000 unused */
+
+#define H1C_F_ST_SILENT_SHUT 0x00004000 /* silent (or dirty) shutdown must be performed */
+/* 0x000008000 unused */
/* Flags indicating the connection state */
#define H1C_F_CS_ERROR 0x00001000 /* connection must be closed ASAP because an error occurred */
static int h1_send(struct h1c *h1c);
static int h1_process(struct h1c *h1c);
static struct task *h1_io_cb(struct task *t, void *ctx, unsigned short state);
-static void h1_shutw_conn(struct connection *conn, enum cs_shw_mode mode);
+static void h1_shutw_conn(struct connection *conn);
static struct task *h1_timeout_task(struct task *t, void *context, unsigned short state);
static void h1_wake_stream_for_recv(struct h1s *h1s);
static void h1_wake_stream_for_send(struct h1s *h1s);
h1_release_buf(h1c, &h1c->obuf);
if (h1c->flags & H1C_F_CS_SHUTW_NOW) {
TRACE_STATE("process pending shutdown for writes", H1_EV_H1C_SEND, h1c->conn);
- h1_shutw_conn(conn, CS_SHW_NORMAL);
+ h1_shutw_conn(conn);
}
}
else if (!(h1c->wait_event.events & SUB_RETRY_SEND)) {
do_shutw:
h1c->flags |= H1C_F_CS_SHUTW_NOW;
+ if (mode != CS_SHW_NORMAL)
+ h1c->flags |= H1C_F_ST_SILENT_SHUT;
if ((cs->flags & CS_FL_SHW) || b_data(&h1c->obuf))
goto end;
- h1_shutw_conn(cs->conn, mode);
+ h1_shutw_conn(cs->conn);
end:
TRACE_LEAVE(H1_EV_STRM_SHUT, h1c->conn, h1s);
}
-static void h1_shutw_conn(struct connection *conn, enum cs_shw_mode mode)
+static void h1_shutw_conn(struct connection *conn)
{
struct h1c *h1c = conn->ctx;
if (conn->flags & CO_FL_SOCK_WR_SH)
return;
- TRACE_ENTER(H1_EV_STRM_SHUT, conn, h1c->h1s);
+ TRACE_ENTER(H1_EV_H1C_END, conn);
conn_xprt_shutw(conn);
- conn_sock_shutw(conn, (mode == CS_SHW_NORMAL));
+ conn_sock_shutw(conn, (h1c && !(h1c->flags & H1C_F_ST_SILENT_SHUT)));
h1c->flags = (h1c->flags & ~H1C_F_CS_SHUTW_NOW) | H1C_F_CS_SHUTDOWN;
- TRACE_LEAVE(H1_EV_STRM_SHUT, conn, h1c->h1s);
+ TRACE_LEAVE(H1_EV_STRM_SHUT, conn);
}
/* Called from the upper layer, to unsubscribe <es> from events <event_type>