template(rust): convert transaction list to vecdeque

Allows for more efficient removal from front of the list.

Ticket: #5298
pull/7349/head
Jason Ish 3 years ago committed by Victor Julien
parent 9b0b2beac1
commit e319d31c14

@ -1,4 +1,4 @@
/* Copyright (C) 2018-2020 Open Information Security Foundation
/* Copyright (C) 2018-2022 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
@ -16,6 +16,7 @@
*/
use std;
use std::collections::VecDeque;
use crate::core::{ALPROTO_UNKNOWN, AppProto, Flow, IPPROTO_TCP};
use crate::applayer::{self, *};
use std::ffi::CString;
@ -54,7 +55,7 @@ impl Transaction for TemplateTransaction {
pub struct TemplateState {
tx_id: u64,
transactions: Vec<TemplateTransaction>,
transactions: VecDeque<TemplateTransaction>,
request_gap: bool,
response_gap: bool,
}
@ -73,7 +74,7 @@ impl TemplateState {
pub fn new() -> Self {
Self {
tx_id: 0,
transactions: Vec::new(),
transactions: VecDeque::new(),
request_gap: false,
response_gap: false,
}
@ -150,7 +151,7 @@ impl TemplateState {
SCLogNotice!("Request: {}", request);
let mut tx = self.new_tx();
tx.request = Some(request);
self.transactions.push(tx);
self.transactions.push_back(tx);
},
Err(nom::Err::Incomplete(_)) => {
// Not enough data. This parser doesn't give us a good indication

Loading…
Cancel
Save