]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
dns: convert transaction list to vecdeque
authorJason Ish <jason.ish@oisf.net>
Tue, 26 Apr 2022 19:25:40 +0000 (13:25 -0600)
committerVictor Julien <vjulien@oisf.net>
Sat, 30 Apr 2022 05:58:21 +0000 (07:58 +0200)
Allows for more efficient removal from front of the list.

Ticket: #5277

rust/src/dns/dns.rs

index 4f5cfa85395574d19a4e5191362de45025b489e3..fe00d04faa3338ba4859a5701ba91118cfd8a956 100644 (file)
@@ -311,7 +311,7 @@ pub struct DNSState {
     pub tx_id: u64,
 
     // Transactions.
-    pub transactions: Vec<DNSTransaction>,
+    pub transactions: VecDeque<DNSTransaction>,
 
     pub events: u16,
 
@@ -401,7 +401,7 @@ impl DNSState {
 
                 let mut tx = self.new_tx();
                 tx.request = Some(request);
-                self.transactions.push(tx);
+                self.transactions.push_back(tx);
 
                 if z_flag {
                     SCLogDebug!("Z-flag set on DNS response");
@@ -445,7 +445,7 @@ impl DNSState {
                     }
                 }
                 tx.response = Some(response);
-                self.transactions.push(tx);
+                self.transactions.push_back(tx);
 
                 if z_flag {
                     SCLogDebug!("Z-flag set on DNS response");