mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
MINOR: quic_pacing: define frms list and use it for MUX STREAM emission
This commit is contained in:
parent
936ddf0be5
commit
340464adc6
@ -1,9 +1,11 @@
|
||||
#ifndef _HAPROXY_QUIC_PACING_T_H
|
||||
#define _HAPROXY_QUIC_PACING_T_H
|
||||
|
||||
#include <haproxy/api-t.h>
|
||||
#include <haproxy/quic_cc-t.h>
|
||||
|
||||
struct quic_pacer {
|
||||
struct list frms;
|
||||
const struct quic_cc_path *path;
|
||||
};
|
||||
|
||||
|
@ -3,10 +3,30 @@
|
||||
|
||||
#include <haproxy/quic_pacing-t.h>
|
||||
|
||||
#include <haproxy/list.h>
|
||||
#include <haproxy/quic_frame.h>
|
||||
|
||||
static inline void quic_pacing_init(struct quic_pacer *pacer,
|
||||
const struct quic_cc_path *path)
|
||||
{
|
||||
LIST_INIT(&pacer->frms);
|
||||
pacer->path = path;
|
||||
}
|
||||
|
||||
static inline void quic_pacing_reset(struct quic_pacer *pacer)
|
||||
{
|
||||
struct quic_frame *frm;
|
||||
|
||||
while (!LIST_ISEMPTY(&pacer->frms)) {
|
||||
frm = LIST_ELEM(pacer->frms.n, struct quic_frame *, list);
|
||||
/* qc_frm_free is responsible to detach frm from pacer list. */
|
||||
qc_frm_free(NULL, &frm);
|
||||
}
|
||||
}
|
||||
|
||||
static inline struct list *quic_pacing_frms(struct quic_pacer *pacer)
|
||||
{
|
||||
return &pacer->frms;
|
||||
}
|
||||
|
||||
#endif /* _HAPROXY_QUIC_PACING_H */
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <haproxy/quic_enc.h>
|
||||
#include <haproxy/quic_fctl.h>
|
||||
#include <haproxy/quic_frame.h>
|
||||
#include <haproxy/quic_pacing.h>
|
||||
#include <haproxy/quic_sock.h>
|
||||
#include <haproxy/quic_stream.h>
|
||||
#include <haproxy/quic_tp-t.h>
|
||||
@ -2244,8 +2245,8 @@ static int qcs_send(struct qcs *qcs, struct list *frms, uint64_t window_conn)
|
||||
*/
|
||||
static int qcc_io_send(struct qcc *qcc)
|
||||
{
|
||||
struct list frms = LIST_HEAD_INIT(frms);
|
||||
/* Temporary list for QCS on error. */
|
||||
struct list *frms = quic_pacing_frms(&qcc->tx.pacer);
|
||||
struct list qcs_failed = LIST_HEAD_INIT(qcs_failed);
|
||||
struct qcs *qcs, *qcs_tmp, *first_qcs = NULL;
|
||||
uint64_t window_conn = qfctl_rcap(&qcc->tx.fc);
|
||||
@ -2338,7 +2339,7 @@ static int qcc_io_send(struct qcc *qcc)
|
||||
|
||||
if (!qfctl_rblocked(&qcc->tx.fc) &&
|
||||
!qfctl_rblocked(&qcs->tx.fc) && window_conn > total) {
|
||||
if ((ret = qcs_send(qcs, &frms, window_conn - total)) < 0) {
|
||||
if ((ret = qcs_send(qcs, frms, window_conn - total)) < 0) {
|
||||
/* Temporarily remove QCS from send-list. */
|
||||
LIST_DEL_INIT(&qcs->el_send);
|
||||
LIST_APPEND(&qcs_failed, &qcs->el_send);
|
||||
@ -2362,7 +2363,7 @@ static int qcc_io_send(struct qcc *qcc)
|
||||
/* Retry sending until no frame to send, data rejected or connection
|
||||
* flow-control limit reached.
|
||||
*/
|
||||
while (qcc_send_frames(qcc, &frms) == 0 && !qfctl_rblocked(&qcc->tx.fc)) {
|
||||
while ((ret = qcc_send_frames(qcc, frms)) == 0 && !qfctl_rblocked(&qcc->tx.fc)) {
|
||||
window_conn = qfctl_rcap(&qcc->tx.fc);
|
||||
resent = 0;
|
||||
|
||||
@ -2380,7 +2381,7 @@ static int qcc_io_send(struct qcc *qcc)
|
||||
BUG_ON(resent > window_conn);
|
||||
|
||||
if (!qfctl_rblocked(&qcs->tx.fc) && window_conn > resent) {
|
||||
if ((ret = qcs_send(qcs, &frms, window_conn - resent)) < 0) {
|
||||
if ((ret = qcs_send(qcs, frms, window_conn - resent)) < 0) {
|
||||
LIST_DEL_INIT(&qcs->el_send);
|
||||
LIST_APPEND(&qcs_failed, &qcs->el_send);
|
||||
continue;
|
||||
@ -2394,12 +2395,7 @@ static int qcc_io_send(struct qcc *qcc)
|
||||
|
||||
sent_done:
|
||||
/* Deallocate frames that the transport layer has rejected. */
|
||||
if (!LIST_ISEMPTY(&frms)) {
|
||||
struct quic_frame *frm, *frm2;
|
||||
|
||||
list_for_each_entry_safe(frm, frm2, &frms, list)
|
||||
qc_frm_free(qcc->conn->handle.qc, &frm);
|
||||
}
|
||||
quic_pacing_reset(&qcc->tx.pacer);
|
||||
|
||||
/* Re-insert on-error QCS at the end of the send-list. */
|
||||
if (!LIST_ISEMPTY(&qcs_failed)) {
|
||||
@ -2719,6 +2715,8 @@ static void qcc_release(struct qcc *qcc)
|
||||
qc_frm_free(qcc->conn->handle.qc, &frm);
|
||||
}
|
||||
|
||||
quic_pacing_reset(&qcc->tx.pacer);
|
||||
|
||||
if (qcc->app_ops && qcc->app_ops->release)
|
||||
qcc->app_ops->release(qcc->ctx);
|
||||
TRACE_PROTO("application layer released", QMUX_EV_QCC_END, conn);
|
||||
|
Loading…
x
Reference in New Issue
Block a user