uint64_t offset; /* the current offset of data to send */
uint64_t bytes; /* number of bytes sent */
struct buffer buf; /* transmit buffer, always valid (buf_empty or real buffer) */
+ struct buffer mbuf[QCC_MBUF_CNT];
} tx;
struct wait_event *subs; /* recv wait_event the conn_stream associated is waiting on (via qc_subscribe) */
struct list list; /* To be used when adding in qcc->send_list or qcc->fctl_lsit */
return ret;
}
+/* Return next empty buffer of mux.
+ * TODO to optimize memory consumption, a non-full buffer should be used before
+ * allocating a new one.
+ * TODO put this in mux ??
+ */
+static struct buffer *get_mux_next_tx_buf(struct qcs *qcs)
+{
+ struct buffer *buf = br_tail(qcs->tx.mbuf);
+
+ if (b_data(buf))
+ buf = br_tail_add(qcs->tx.mbuf);
+
+ if (!b_size(buf))
+ qc_get_buf(qcs->qcc, buf);
+
+ if (!buf)
+ ABORT_NOW();
+
+ return buf;
+
+}
+
/* Finalize the initialization of remotely initiated uni-stream <qcs>.
* Return 1 if succeeded, 0 if not. In this latter case, set the ->err h3 error
* to inform the QUIC mux layer of the encountered error.
qcs->tx.st = QC_TX_SS_IDLE;
qcs->tx.bytes = qcs->tx.offset = 0;
qcs->tx.max_data = qcc->strms[qcs_type].tx.max_data;
+ qcs->tx.buf = BUF_NULL;
+ br_init(qcs->tx.mbuf, sizeof(qcs->tx.mbuf) / sizeof(qcs->tx.mbuf[0]));
eb64_insert(&qcc->streams_by_id, &qcs->by_id);
qcc->strms[qcs_type].nb_streams++;
qcs->tx.max_data = qcc->strms[qcs_type].tx.max_data;
qcs->tx.offset = qcs->tx.bytes = 0;
qcs->tx.buf = BUF_NULL;
+ br_init(qcs->tx.mbuf, sizeof(qcs->tx.mbuf) / sizeof(qcs->tx.mbuf[0]));
qcs->subs = NULL;
LIST_INIT(&qcs->list);
qcs->rx.max_data = qcc->strms[qcs_type].rx.max_data;
qcs->rx.offset = qcs->rx.bytes = 0;
qcs->rx.buf = BUF_NULL;
+ br_init(qcs->tx.mbuf, sizeof(qcs->tx.mbuf) / sizeof(qcs->tx.mbuf[0]));
qcs->subs = NULL;
LIST_INIT(&qcs->list);