/* Signal the closing of remote stream with id <id>. Flow-control for new
* streams may be allocated for the peer if needed.
+ *
+ * Returns 0 on success or non zero in case of a fatal connection error.
*/
static int qcc_release_remote_stream(struct qcc *qcc, uint64_t id)
{
struct qcc *qcc = qcs->qcc;
struct connection *conn = qcc->conn;
const uint64_t id = qcs->id;
+ int ret = 0;
TRACE_ENTER(QMUX_EV_QCS_END, conn, qcs);
BUG_ON(qcs->tx.fc.off_soft != qcs->tx.fc.off_real);
if (quic_stream_is_remote(qcc, id))
- qcc_release_remote_stream(qcc, id);
- }
+ ret = qcc_release_remote_stream(qcc, id);
- /* If some data are not yet consumed, account them in conn flow
- * control. On frontend, this may happen when FE stream is released
- * prior to request completion.
- *
- * TODO QCS should not be released if not closed remotely to guarantee
- * the connection flow control consistency
- */
- if (!qcs_is_close_remote(qcs) && qcs->rx.offset_max > qcs->rx.offset) {
- COUNT("QCS is released while not remotely closed. "
- "This may cause miscalculation in conn flow control.");
- qcc_account_for_conn_fctl(qcc, qcs->rx.offset_max - qcs->rx.offset);
+ /* If some data are not yet consumed, account them in conn flow
+ * control. On frontend, this may happen when FE stream is
+ * released prior to request completion.
+ *
+ * TODO QCS should not be released if not closed remotely to
+ * guarantee the connection flow control consistency
+ */
+ if (!ret && !qcs_is_close_remote(qcs) && qcs->rx.offset_max > qcs->rx.offset) {
+ COUNT("QCS is released while not remotely closed. "
+ "This may cause miscalculation in conn flow control.");
+ qcc_account_for_conn_fctl(qcc, qcs->rx.offset_max - qcs->rx.offset);
+ }
}
qcs_free(qcs);