Skip to content

Commit

Permalink
Don't keep creating CONNECTION_CLOSE frames
Browse files Browse the repository at this point in the history
If we want to send a CONNECTION_CLOSE frame then one is enough unless we
are scheduled to send another one. Now that we can create more than one
datagram in one go this is now required.
  • Loading branch information
mattcaswell committed Aug 21, 2023
1 parent 293baa3 commit 1fc67fa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/internal/quic_txpim.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ typedef struct quic_txpim_pkt_st {
unsigned int had_max_streams_bidi_frame : 1;
unsigned int had_max_streams_uni_frame : 1;
unsigned int had_ack_frame : 1;
unsigned int had_conn_close : 1;

/* Private data follows. */
} QUIC_TXPIM_PKT;
Expand Down
4 changes: 4 additions & 0 deletions ssl/quic/quic_txp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1806,6 +1806,7 @@ static int txp_generate_pre_token(OSSL_QUIC_TX_PACKETISER *txp,
if (!tx_helper_commit(h))
return 0;

tpkt->had_conn_close = 1;
*can_be_non_inflight = 0;
} else {
tx_helper_rollback(h);
Expand Down Expand Up @@ -2946,6 +2947,9 @@ static int txp_pkt_commit(OSSL_QUIC_TX_PACKETISER *txp,
if (tpkt->had_ack_frame)
txp->want_ack &= ~(1UL << pn_space);

if (tpkt->had_conn_close)
txp->want_conn_close = 0;

/*
* Decrement probe request counts if we have sent a packet that meets
* the requirement of a probe, namely being ACK-eliciting.
Expand Down
1 change: 1 addition & 0 deletions ssl/quic/quic_txpim.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ static void txpim_clear(QUIC_TXPIM_PKT_EX *ex)
ex->public.had_max_streams_bidi_frame = 0;
ex->public.had_max_streams_uni_frame = 0;
ex->public.had_ack_frame = 0;
ex->public.had_conn_close = 0;
}

QUIC_TXPIM_PKT *ossl_quic_txpim_pkt_alloc(QUIC_TXPIM *txpim)
Expand Down

0 comments on commit 1fc67fa

Please sign in to comment.