diff --git a/src/mux_quic.c b/src/mux_quic.c index ea8c38b5f..302dc155b 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -3359,8 +3359,12 @@ static void qmux_strm_shut(struct stconn *sc, unsigned int mode, struct se_abort if (!qcs_is_close_local(qcs) && !(qcs->flags & (QC_SF_FIN_STREAM|QC_SF_TO_RESET))) { - if (qcs->flags & QC_SF_UNKNOWN_PL_LENGTH) { - /* Close stream with a FIN STREAM frame. */ + /* Close stream with FIN if length unknown and some data are + * ready to be/already transmitted. + * TODO select closure method on app proto layer + */ + if (qcs->flags & QC_SF_UNKNOWN_PL_LENGTH && + qcs->tx.fc.off_soft) { if (!(qcc->flags & (QC_CF_ERR_CONN|QC_CF_ERRL))) { TRACE_STATE("set FIN STREAM", QMUX_EV_STRM_SHUT, qcc->conn, qcs); @@ -3485,7 +3489,7 @@ static const struct mux_ops qmux_ops = { .subscribe = qmux_strm_subscribe, .unsubscribe = qmux_strm_unsubscribe, .wake = qmux_wake, - .shut = qmux_strm_shut, + .shut = qmux_strm_shut, .ctl = qmux_ctl, .sctl = qmux_sctl, .show_sd = qmux_strm_show_sd,