]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Stream: fix unittests after ssn pool changes.
authorVictor Julien <victor@inliniac.net>
Mon, 27 May 2013 08:24:31 +0000 (10:24 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 28 Jun 2013 09:16:08 +0000 (11:16 +0200)
src/stream-tcp.c

index 0c433e76acdcba1640c36d63a545c3dcc37c049d..bddf8dce30a9559d2823a998ddd6dc2ac49fa4fb 100644 (file)
@@ -566,6 +566,22 @@ void StreamTcpInitConfig(char quiet)
      * values. */
     FlowSetProtoFreeFunc(IPPROTO_TCP, StreamTcpSessionClear);
     FlowSetFlowStateFunc(IPPROTO_TCP, StreamTcpGetFlowState);
+
+#ifdef UNITTESTS
+    if (RunmodeIsUnittests()) {
+        SCMutexLock(&ssn_pool_mutex);
+        if (ssn_pool == NULL) {
+            ssn_pool = PoolThreadInit(1, /* thread */
+                    0, /* unlimited */
+                    stream_config.prealloc_sessions,
+                    sizeof(TcpSession),
+                    StreamTcpSessionPoolAlloc,
+                    StreamTcpSessionPoolInit, NULL,
+                    StreamTcpSessionPoolCleanup, NULL);
+        }
+        SCMutexUnlock(&ssn_pool_mutex);
+    }
+#endif
 }
 
 void StreamTcpFreeConfig(char quiet)