From c30dbff63dde9db2a8b5fd0b24683ee63e934d22 Mon Sep 17 00:00:00 2001 From: Anoop Saldanha Date: Fri, 9 Sep 2011 22:56:01 +0530 Subject: [PATCH] update flow pruning - v4 --- src/flow.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/flow.c b/src/flow.c index a8ecc9e174..d3e54fbb08 100644 --- a/src/flow.c +++ b/src/flow.c @@ -639,7 +639,23 @@ static int FlowPrune(ThreadVars *tv, FlowQueue *q, struct timeval *ts) } if (FlowForceReassemblyForFlowV2(tv, f) == 1) { - return cnt; + int mr = SCMutexTrylock(&q->mutex_q); + if (mr != 0) { + SCLogDebug("trylock failed"); + if (mr == EBUSY) + SCLogDebug("was locked"); + if (mr == EINVAL) + SCLogDebug("bad mutex value"); + return cnt; + } + /* this ain't perfect. There is no guaranted that both f and qnext_f + * are in q. For all we know they might both be transferred to some + * other queue in the same order. We need to fix this. */ + if (f->lnext == qnext_f) + f = qnext_f; + else + f = q->top; + goto FlowPrune_Prune_Next; } /* this should not be possible */