From 26bb18cfaaa76eb728b61b763139aad5b8ae842d Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Tue, 2 Jun 2026 13:27:59 +0200 Subject: [PATCH] http2: replace state todrop with a dedicated boolean Ticket: 8518 --- rust/src/http2/http2.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/rust/src/http2/http2.rs b/rust/src/http2/http2.rs index 04379acad3..4667a134dc 100644 --- a/rust/src/http2/http2.rs +++ b/rust/src/http2/http2.rs @@ -136,8 +136,6 @@ pub enum HTTP2TxProgress { HTTP2ProgComplete = 4, //not a RFC-defined state, used for stream 0 frames applying to the global connection HTTP2ProgGlobal = 5, - //not a RFC-defined state, dropping this old tx because we have too many - HTTP2ProgTodrop = 6, } #[derive(Debug)] @@ -165,6 +163,7 @@ pub struct HTTP2Transaction { pub stream_id: u32, pub progress_tc: HTTP2TxProgress, pub progress_ts: HTTP2TxProgress, + to_drop: bool, child_stream_id: u32, pub frames_tc: Vec, @@ -203,6 +202,7 @@ impl HTTP2Transaction { child_stream_id: 0, progress_tc: HTTP2TxProgress::HTTP2ProgStart, progress_ts: HTTP2TxProgress::HTTP2ProgStart, + to_drop: false, frames_tc: Vec::new(), frames_ts: Vec::new(), decoder: decompression::HTTP2Decoder::new(), @@ -767,14 +767,15 @@ impl HTTP2State { if header.stream_id == 0 { if self.transactions.len() >= unsafe { HTTP2_MAX_STREAMS } { for tx_old in &mut self.transactions { - if tx_old.progress_ts == HTTP2TxProgress::HTTP2ProgTodrop { + if tx_old.to_drop { // loop was already run break; } tx_old.set_event(HTTP2Event::TooManyStreams); // use a distinct state, even if we do not log it - tx_old.progress_ts = HTTP2TxProgress::HTTP2ProgTodrop; - tx_old.progress_tc = HTTP2TxProgress::HTTP2ProgTodrop; + tx_old.progress_ts = HTTP2TxProgress::HTTP2ProgComplete; + tx_old.progress_tc = HTTP2TxProgress::HTTP2ProgComplete; + tx_old.to_drop = true; tx_old.tx_data.0.updated_tc = true; tx_old.tx_data.0.updated_ts = true; } @@ -819,14 +820,15 @@ impl HTTP2State { // do not use SETTINGS_MAX_CONCURRENT_STREAMS as it can grow too much if self.transactions.len() >= unsafe { HTTP2_MAX_STREAMS } { for tx_old in &mut self.transactions { - if tx_old.progress_ts == HTTP2TxProgress::HTTP2ProgTodrop { + if tx_old.to_drop { // loop was already run break; } tx_old.set_event(HTTP2Event::TooManyStreams); // use a distinct state, even if we do not log it - tx_old.progress_ts = HTTP2TxProgress::HTTP2ProgTodrop; - tx_old.progress_tc = HTTP2TxProgress::HTTP2ProgTodrop; + tx_old.progress_ts = HTTP2TxProgress::HTTP2ProgComplete; + tx_old.progress_tc = HTTP2TxProgress::HTTP2ProgComplete; + tx_old.to_drop = true; tx_old.tx_data.0.updated_tc = true; tx_old.tx_data.0.updated_ts = true; }