]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow: avoid double state update on reuse
authorVictor Julien <victor@inliniac.net>
Thu, 30 Jul 2020 11:22:15 +0000 (13:22 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 30 Jul 2020 11:22:54 +0000 (13:22 +0200)
Avoids an unnecessary atomic operation.

src/flow-hash.c

index 17fec620caebe678a2da11cb8da1f753918be13e..7c590016c3488118832a79f0e0e8af5847099ad1 100644 (file)
@@ -574,6 +574,7 @@ static Flow *TcpReuseReplace(ThreadVars *tv, DecodeThreadVars *dtv,
     FlowInit(f, p);
     f->flow_hash = hash;
     f->fb = fb;
+    FlowUpdateState(f, FLOW_STATE_NEW);
 
     f->thread_id[0] = thread_id[0];
     f->thread_id[1] = thread_id[1];
@@ -952,8 +953,6 @@ static Flow *FlowGetUsedFlow(ThreadVars *tv, DecodeThreadVars *dtv)
 
         FlowClearMemory(f, f->protomap);
 
-        FlowUpdateState(f, FLOW_STATE_NEW);
-
         FLOWLOCK_UNLOCK(f);
         return f;
     }