]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
pgsql: separate request completion and state type
authorJuliana Fajardini <jufajardini@oisf.net>
Tue, 20 May 2025 18:56:03 +0000 (15:56 -0300)
committerJuliana Fajardini <jufajardini@oisf.net>
Wed, 4 Jun 2025 18:21:32 +0000 (15:21 -0300)
Since some of state types could indicate a request completion, don't
process them in if/else statements.

Related to
Task #7645

rust/src/pgsql/pgsql.rs

index b6409ad39b3031101f24a00e532c1d3274bc87e5..89055617da15662e2a8cdd367758e8fd4b9d3726 100644 (file)
@@ -415,7 +415,7 @@ impl PgsqlState {
                             || state == PgsqlStateProgress::ConsolidatingCopyDataIn {
                                 // here we're actually only counting how many messages were received.
                                 // frontends are not forced to send one row per message
-                                if let PgsqlFEMessage::ConsolidatedCopyDataIn(msg) = request {
+                                if let PgsqlFEMessage::ConsolidatedCopyDataIn(ref msg) = request {
                                     tx.sum_data_size(msg.data_size);
                                     tx.incr_row_cnt();
                                 }
@@ -428,11 +428,9 @@ impl PgsqlState {
                                     },
                                 );
                                 tx.requests.push(consolidated_copy_data);
-                                tx.requests.push(request);
-                                // reset values
-                                tx.data_row_cnt = 0;
-                                tx.data_size = 0;
-                            } else if Self::request_is_complete(state) {
+                            }
+
+                            if Self::request_is_complete(state) {
                                 tx.requests.push(request);
                                 // The request is complete at this point
                                 tx.tx_req_state = PgsqlTxProgress::TxDone;