#define H2_CF_DEM_IN_PROGRESS 0x00000400 // demux in progress (dsi,dfl,dft are valid)
/* other flags */
+#define H2_CF_MBUF_HAS_DATA 0x00000800 // some stream data (data, headers) still in mbuf
#define H2_CF_GOAWAY_SENT 0x00001000 // a GOAWAY frame was successfully sent
#define H2_CF_GOAWAY_FAILED 0x00002000 // a GOAWAY frame failed to be sent
#define H2_CF_WAIT_FOR_HS 0x00004000 // We did check that at least a stream was waiting for handshake
/* We're done, no more to send */
if (!(conn->flags & CO_FL_WAIT_XPRT) && !br_data(h2c->mbuf)) {
TRACE_DEVEL("leaving with everything sent", H2_EV_H2C_SEND, h2c->conn);
- if (!h2c->nb_sc)
+ if (h2c->flags & H2_CF_MBUF_HAS_DATA && !h2c->nb_sc) {
+ h2c->flags &= ~H2_CF_MBUF_HAS_DATA;
h2c->idle_start = now_ms;
+ }
goto end;
}
/* commit the H2 response */
b_add(mbuf, outbuf.data);
+ h2c->flags |= H2_CF_MBUF_HAS_DATA;
/* indicates the HEADERS frame was sent, except for 1xx responses. For
* 1xx responses, another HEADERS frame is expected.
/* commit the H2 response */
b_add(mbuf, outbuf.data);
+ h2c->flags |= H2_CF_MBUF_HAS_DATA;
h2s->flags |= H2_SF_HEADERS_SENT;
h2s->st = H2_SS_OPEN;
buf->data = buf->head = 0;
total += fsize;
fsize = 0;
+ h2c->flags |= H2_CF_MBUF_HAS_DATA;
TRACE_PROTO("sent H2 DATA frame (zero-copy)", H2_EV_TX_FRAME|H2_EV_TX_DATA, h2c->conn, h2s);
goto out;
/* commit the H2 response */
b_add(mbuf, fsize + 9);
+ h2c->flags |= H2_CF_MBUF_HAS_DATA;
out:
if (es_now) {
/* commit the H2 response */
TRACE_PROTO("sent H2 trailers HEADERS frame", H2_EV_TX_FRAME|H2_EV_TX_HDR|H2_EV_TX_EOI, h2c->conn, h2s);
b_add(mbuf, outbuf.data);
+ h2c->flags |= H2_CF_MBUF_HAS_DATA;
h2s->flags |= H2_SF_ES_SENT;
if (h2s->st == H2_SS_OPEN)