From 913ab2407329d98b523198655c5cf9b0fa097fff Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Mon, 31 Jul 1995 17:47:36 +0000 Subject: (connq_interrupt_sock): Reset CQ's tail to the end of the compressed queue. --- pflocal/connq.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'pflocal') diff --git a/pflocal/connq.c b/pflocal/connq.c index ee326509..8f06ba29 100644 --- a/pflocal/connq.c +++ b/pflocal/connq.c @@ -286,7 +286,7 @@ debug (cq, "out"); void connq_interrupt_sock (struct connq *cq, struct sock *sock) { - unsigned pos, comp_pos; + unsigned pos, comp_tail; debug (cq, "in"); debug (cq, "lock"); @@ -305,17 +305,20 @@ debug (cq, "interrupt connections from: %p", sock); debug (cq, "compress queue"); /* Now compress the queue to remove any null entries we put in. */ - for (pos = cq->head, comp_pos = cq->head; + for (pos = cq->head, comp_tail = cq->head; pos != cq->tail; pos = qnext (cq, pos)) if (cq->queue[pos] != NULL) /* This position has a non-NULL request, so move it to the end of the compressed queue. */ { - cq->queue[comp_pos] = cq->queue[pos]; - comp_pos = qnext (cq, comp_pos); + cq->queue[comp_tail] = cq->queue[pos]; + comp_tail = qnext (cq, comp_tail); } + /* Move back tail to only include what we kept in the queue. */ + cq->tail = comp_tail; + debug (cq, "unlock"); mutex_unlock (&cq->lock); debug (cq, "out"); -- cgit v1.2.3