#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 */
#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>
*/
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);
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);
/* 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;
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;
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)) {
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);