From 708e80c90023b4b122f57542ba92099a661bbca1 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 26 Aug 2015 14:25:16 +0200 Subject: [PATCH] stream: optimize proto detect segment handling In case of protocol detection not yet being complete, the segment list was walked unconditionally to unset the app layer processed flag. Optimize this to bail on the first segment that doesn't have the flag set. --- src/stream-tcp-reassemble.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/stream-tcp-reassemble.c b/src/stream-tcp-reassemble.c index caf955afa1..912a446d3c 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -3035,6 +3035,8 @@ int StreamTcpReassembleAppLayer (ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx, } else { TcpSegment *tmp_seg = stream->seg_list; while (tmp_seg != NULL) { + if (!(tmp_seg->flags & SEGMENTTCP_FLAG_APPLAYER_PROCESSED)) + break; tmp_seg->flags &= ~SEGMENTTCP_FLAG_APPLAYER_PROCESSED; tmp_seg = tmp_seg->next; } -- 2.47.2