move flow incr cnt while we actually create the pseudo packet in forced reassembly

remotes/origin/master-1.1.x
Anoop Saldanha 15 years ago committed by Victor Julien
parent 51d2b64902
commit 56fba8e275

@ -208,6 +208,7 @@ static inline Packet *FFRPseudoPacketSetup(int direction, Flow *f)
p->proto = IPPROTO_TCP; p->proto = IPPROTO_TCP;
p->flow = f; p->flow = f;
FlowIncrUsecnt(f);
p->flags |= PKT_STREAM_EST; p->flags |= PKT_STREAM_EST;
p->flags |= PKT_STREAM_EOF; p->flags |= PKT_STREAM_EOF;
p->flags |= PKT_HAS_FLOW; p->flags |= PKT_HAS_FLOW;
@ -353,14 +354,6 @@ static inline int FlowForceReassemblyForFlowV2(ThreadVars *tv, Flow *f)
f->flags |= FLOW_TIMEOUT_REASSEMBLY_DONE; f->flags |= FLOW_TIMEOUT_REASSEMBLY_DONE;
/* we need to incr use counts before we unlock the flow */
if (client_ok == 1) {
FlowIncrUsecnt(f);
}
if (server_ok == 1) {
FlowIncrUsecnt(f);
}
/* move this unlock after the strream reassemble call */ /* move this unlock after the strream reassemble call */
SCSpinUnlock(&f->fb->s); SCSpinUnlock(&f->fb->s);
@ -646,24 +639,25 @@ static int FlowPrune(ThreadVars *tv, FlowQueue *q, struct timeval *ts, int try_c
} }
if (FlowForceReassemblyForFlowV2(tv, f) == 1) { if (FlowForceReassemblyForFlowV2(tv, f) == 1) {
int mr = SCMutexTrylock(&q->mutex_q); //int mr = SCMutexTrylock(&q->mutex_q);
if (mr != 0) { //if (mr != 0) {
SCLogDebug("trylock failed"); // SCLogDebug("trylock failed");
if (mr == EBUSY) // if (mr == EBUSY)
SCLogDebug("was locked"); // SCLogDebug("was locked");
if (mr == EINVAL) // if (mr == EINVAL)
SCLogDebug("bad mutex value"); // 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;
return cnt; 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 */ /* this should not be possible */
BUG_ON(SC_ATOMIC_GET(f->use_cnt) > 0); BUG_ON(SC_ATOMIC_GET(f->use_cnt) > 0);

Loading…
Cancel
Save