]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Assign thread_id to flow on first packet stream engine
authorVictor Julien <victor@inliniac.net>
Tue, 25 Nov 2014 10:50:03 +0000 (11:50 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 17 Dec 2014 13:06:08 +0000 (14:06 +0100)
src/stream-tcp.c

index 5bb30f614a8cd36c1b51d536245f42eb685f464d..9e3d8fb34cbc85f31c78f9ae8493a382fd230946 100644 (file)
@@ -4382,6 +4382,15 @@ int StreamTcpPacket (ThreadVars *tv, Packet *p, StreamTcpThread *stt,
 
     SCLogDebug("p->pcap_cnt %"PRIu64, p->pcap_cnt);
 
+    /* assign the thread id to the flow */
+    if (unlikely(p->flow->thread_id == 0)) {
+        p->flow->thread_id = (FlowThreadId)tv->id;
+#ifdef DEBUG
+    } else if (unlikely((FlowThreadId)tv->id != p->flow->thread_id)) {
+        SCLogDebug("wrong thread: flow has %u, we are %d", p->flow->thread_id, tv->id);
+#endif
+    }
+
     TcpSession *ssn = (TcpSession *)p->flow->protoctx;
 
     /* track TCP flags */