From fd7899cc8b393b7ffaab43b393453c4828a33569 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 27 May 2013 10:24:31 +0200 Subject: [PATCH] Stream: fix unittests after ssn pool changes. --- src/stream-tcp.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/stream-tcp.c b/src/stream-tcp.c index 0c433e76ac..bddf8dce30 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -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)