return -1;
}
-/* Function used to emit stream data from <qcs> control uni-stream */
+/* Function used to emit stream data from <qcs> control uni-stream.
+ *
+ * On success return the number of sent bytes. A negative code is used on
+ * error.
+ */
static int h3_control_send(struct qcs *qcs, void *ctx)
{
int ret;
b_quic_enc_int(&pos, h3_settings_max_field_section_size, 0);
}
- res = qcc_get_stream_txbuf(qcs);
+ if (!(res = qcc_get_stream_txbuf(qcs))) {
+ TRACE_ERROR("cannot allocate Tx buffer", H3_EV_TX_FRAME|H3_EV_TX_SETTINGS, qcs->qcc->conn, qcs);
+ goto err;
+ }
+
if (b_room(res) < b_data(&pos)) {
// TODO the mux should be put in blocked state, with
// the stream in state waiting for settings to be sent
TRACE_LEAVE(H3_EV_TX_FRAME|H3_EV_TX_SETTINGS, qcs->qcc->conn, qcs);
return ret;
+
+ err:
+ TRACE_DEVEL("leaving on error", H3_EV_TX_FRAME|H3_EV_TX_SETTINGS, qcs->qcc->conn, qcs);
+ return -1;
}
static int h3_resp_headers_send(struct qcs *qcs, struct htx *htx)
goto err;
}
- h3_control_send(qcs, h3c);
h3c->ctrl_strm = qcs;
+ if (h3_control_send(qcs, h3c) < 0)
+ goto err;
+
TRACE_LEAVE(H3_EV_H3C_NEW, qcc->conn);
return 0;