mqtt: fix quadratic complexity

get_tx_by_pkt_id loops only over the last transactions
in case there is a transaction flood

Ticket: #6100
pull/8945/head
Philippe Antoine 2 years ago committed by Victor Julien
parent 8e19906afa
commit 7d3aa91bf4

@ -170,7 +170,7 @@ impl MQTTState {
}
pub fn get_tx_by_pkt_id(&mut self, pkt_id: u32) -> Option<&mut MQTTTransaction> {
for tx in &mut self.transactions {
for tx in &mut self.transactions.range_mut(self.tx_index_completed..) {
if !tx.complete {
if let Some(mpktid) = tx.pkt_id {
if mpktid == pkt_id {

Loading…
Cancel
Save