2020#include <haproxy/trace.h>
2121#include <haproxy/quic_cid.h>
2222#include <haproxy/quic_conn.h>
23+ #include <haproxy/quic_pacing.h>
2324#include <haproxy/quic_retransmit.h>
2425#include <haproxy/quic_retry.h>
2526#include <haproxy/quic_sock.h>
@@ -469,11 +470,12 @@ int qc_purge_txbuf(struct quic_conn *qc, struct buffer *buf)
469470 *
470471 * Returns the result from qc_send() function.
471472 */
472- enum quic_tx_err qc_send_mux (struct quic_conn * qc , struct list * frms )
473+ enum quic_tx_err qc_send_mux (struct quic_conn * qc , struct list * frms ,
474+ struct quic_pacer * pacer )
473475{
474476 struct list send_list = LIST_HEAD_INIT (send_list );
475477 enum quic_tx_err ret = QUIC_TX_ERR_NONE ;
476- int sent ;
478+ int max_dgram = 0 , sent ;
477479
478480 TRACE_ENTER (QUIC_EV_CONN_TXPKT , qc );
479481 BUG_ON (qc -> mux_state != QC_MUX_READY ); /* Only MUX can uses this function so it must be ready. */
@@ -492,11 +494,20 @@ enum quic_tx_err qc_send_mux(struct quic_conn *qc, struct list *frms)
492494 qc_send (qc , 0 , & send_list , 0 );
493495 }
494496
497+ if (pacer )
498+ max_dgram = 1 ;
499+
495500 TRACE_STATE ("preparing data (from MUX)" , QUIC_EV_CONN_TXPKT , qc );
496501 qel_register_send (& send_list , qc -> ael , frms );
497- sent = qc_send (qc , 0 , & send_list , 0 );
498- if (sent <= 0 )
502+ sent = qc_send (qc , 0 , & send_list , max_dgram );
503+ if (sent <= 0 ) {
499504 ret = QUIC_TX_ERR_FATAL ;
505+ }
506+ else if (pacer ) {
507+ if (max_dgram && max_dgram == sent && !LIST_ISEMPTY (frms ))
508+ ret = QUIC_TX_ERR_AGAIN ;
509+ quic_pacing_sent_done (pacer , sent );
510+ }
500511
501512 TRACE_LEAVE (QUIC_EV_CONN_TXPKT , qc );
502513 return ret ;
0 commit comments