flow engine: no longer allow FlowRequeue to be called with the same src and dst queue.

remotes/origin/master-1.2.x
Victor Julien 15 years ago
parent 84c7480c06
commit bfa872b9b7

@ -136,18 +136,17 @@ Flow *FlowDequeue (FlowQueue *q) {
* \brief Transfer a flow from one queue to another
*
* \param f the flow to be transfered
* \param srcq the source queue, where the flow will be removed. The param may
* be NULL.
* \param srcq the source queue, where the flow will be removed.
* \param dstq the dest queue where the flow will be placed
*
* \note srcq and dstq must be different queues.
*/
void FlowRequeue(Flow *f, FlowQueue *srcq, FlowQueue *dstq)
{
#ifdef DEBUG
BUG_ON(dstq == NULL);
BUG_ON(srcq == NULL || dstq == NULL || srcq == dstq);
#endif /* DEBUG */
if (srcq != NULL) {
SCMutexLock(&srcq->mutex_q);
/* remove from old queue */
@ -169,16 +168,9 @@ void FlowRequeue(Flow *f, FlowQueue *srcq, FlowQueue *dstq)
f->lnext = NULL;
f->lprev = NULL;
/* don't unlock if src and dst are the same */
if (srcq != dstq) {
SCMutexUnlock(&srcq->mutex_q);
}
}
/* now put it in dst */
if (srcq != dstq) {
SCMutexLock(&dstq->mutex_q);
}
/* add to new queue (append) */
f->lprev = dstq->bot;

Loading…
Cancel
Save