mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-08 08:07:10 +02:00
MEDIUM: mux-quic: implement ring buffer on stream tx
This commit is contained in:
parent
990435561b
commit
f52151d83e
@ -199,6 +199,7 @@ struct qcs {
|
||||
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 */
|
||||
|
22
src/h3.c
22
src/h3.c
@ -414,6 +414,28 @@ static int h3_control_send(struct h3_uqs *h3_uqs, void *ctx)
|
||||
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.
|
||||
|
@ -982,6 +982,8 @@ struct qcs *bidi_qcs_new(struct qcc *qcc, uint64_t id)
|
||||
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++;
|
||||
@ -1045,6 +1047,7 @@ struct qcs *luqs_new(struct qcc *qcc)
|
||||
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);
|
||||
@ -1085,6 +1088,7 @@ struct qcs *ruqs_new(struct qcc *qcc, uint64_t id)
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user