From: Victor Julien Date: Wed, 26 Aug 2015 12:25:16 +0000 (+0200) Subject: stream: optimize proto detect segment handling X-Git-Tag: suricata-3.0RC1~161 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=708e80c90023b4b122f57542ba92099a661bbca1;p=thirdparty%2Fsuricata.git 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. --- 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; }