Rewrite forced reassembly v2 using while loop instead of goto

remotes/origin/master-1.1.x
Anoop Saldanha 14 years ago committed by Victor Julien
parent 6cc179fad8
commit e68ca2f32f

@ -482,7 +482,7 @@ static int FlowPrune(FlowQueue *q, struct timeval *ts, int try_cnt)
Flow *f = q->top; Flow *f = q->top;
/* label */ /* label */
FlowPrune_Prune_Next: while (f != NULL) {
if (try_cnt != 0 && try_cnt_temp == try_cnt) { if (try_cnt != 0 && try_cnt_temp == try_cnt) {
SCMutexUnlock(&q->mutex_q); SCMutexUnlock(&q->mutex_q);
return cnt; return cnt;
@ -506,7 +506,7 @@ static int FlowPrune(FlowQueue *q, struct timeval *ts, int try_cnt)
prune_flow_lock++; prune_flow_lock++;
#endif #endif
f = f->lnext; f = f->lnext;
goto FlowPrune_Prune_Next; continue;
} }
if (SCSpinTrylock(&f->fb->s) != 0) { if (SCSpinTrylock(&f->fb->s) != 0) {
@ -517,7 +517,7 @@ static int FlowPrune(FlowQueue *q, struct timeval *ts, int try_cnt)
prune_bucket_lock++; prune_bucket_lock++;
#endif #endif
f = f->lnext; f = f->lnext;
goto FlowPrune_Prune_Next; continue;
} }
/*set the timeout value according to the flow operating mode, flow's state /*set the timeout value according to the flow operating mode, flow's state
@ -595,14 +595,14 @@ static int FlowPrune(FlowQueue *q, struct timeval *ts, int try_cnt)
f = f->lnext; f = f->lnext;
SCSpinUnlock(&prev_f->fb->s); SCSpinUnlock(&prev_f->fb->s);
SCMutexUnlock(&prev_f->m); SCMutexUnlock(&prev_f->m);
goto FlowPrune_Prune_Next; continue;
} }
if (FlowForceReassemblyForFlowV2(f) == 1) { if (FlowForceReassemblyForFlowV2(f) == 1) {
Flow *prev_f = f; Flow *prev_f = f;
f = f->lnext; f = f->lnext;
SCMutexUnlock(&prev_f->m); SCMutexUnlock(&prev_f->m);
goto FlowPrune_Prune_Next; continue;
} }
/* this should not be possible */ /* this should not be possible */
@ -630,7 +630,10 @@ static int FlowPrune(FlowQueue *q, struct timeval *ts, int try_cnt)
SCMutexUnlock(&f->m); SCMutexUnlock(&f->m);
f = next_flow; f = next_flow;
goto FlowPrune_Prune_Next; }
SCMutexUnlock(&q->mutex_q);
return cnt;
} }
/** \brief Time out flows. /** \brief Time out flows.

Loading…
Cancel
Save