From 42c4b5d53cb9893d4a11aa2b596824e66b599948 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Sun, 16 May 2010 18:43:10 +0200 Subject: [PATCH] Use one less thread in pcap file mode. Reduces locking overhead. --- src/runmodes.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/runmodes.c b/src/runmodes.c index 5a5c222096..69979cba68 100644 --- a/src/runmodes.c +++ b/src/runmodes.c @@ -2092,7 +2092,7 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx, char *file) { exit(EXIT_FAILURE); } - ThreadVars *tv_decode1 = TmThreadCreatePacketHandler("Decode1","pickup-queue","simple","decode-queue1","simple","1slot"); + ThreadVars *tv_decode1 = TmThreadCreatePacketHandler("Decode & Stream","pickup-queue","simple","stream-queue1","simple","varslot"); if (tv_decode1 == NULL) { printf("ERROR: TmThreadsCreate failed for Decode1\n"); exit(EXIT_FAILURE); @@ -2102,7 +2102,15 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx, char *file) { printf("ERROR: TmModuleGetByName DecodePcap failed\n"); exit(EXIT_FAILURE); } - Tm1SlotSetFunc(tv_decode1,tm_module,NULL); + TmVarSlotSetFuncAppend(tv_decode1,tm_module,NULL); + + tm_module = TmModuleGetByName("StreamTcp"); + if (tm_module == NULL) { + printf("ERROR: TmModuleGetByName StreamTcp failed\n"); + exit(EXIT_FAILURE); + } + TmVarSlotSetFuncAppend(tv_decode1,tm_module,NULL); + TmThreadSetCPUAffinity(tv_decode1, 0); if (ncpus > 1) TmThreadSetThreadPriority(tv_decode1, PRIO_MEDIUM); @@ -2111,7 +2119,7 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx, char *file) { printf("ERROR: TmThreadSpawn failed\n"); exit(EXIT_FAILURE); } - +/* ThreadVars *tv_stream1 = TmThreadCreatePacketHandler("Stream1","decode-queue1","simple","stream-queue1","simple","1slot"); if (tv_stream1 == NULL) { printf("ERROR: TmThreadsCreate failed for Stream1\n"); @@ -2132,7 +2140,7 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx, char *file) { printf("ERROR: TmThreadSpawn failed\n"); exit(EXIT_FAILURE); } - +*/ for (cpu = 0; cpu < ncpus; cpu++) { snprintf(tname, sizeof(tname),"Detect%"PRIu16, cpu+1); if (tname == NULL)