diff options
author | Miles Bader <miles@gnu.org> | 1995-07-31 17:47:36 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-07-31 17:47:36 +0000 |
commit | 913ab2407329d98b523198655c5cf9b0fa097fff (patch) | |
tree | ed4c701c06ca0fd87fdf92811540192e3461fbbf /pflocal/connq.c | |
parent | 3d925e8af601e8f6ac2c71a3221d774162a5cece (diff) |
(connq_interrupt_sock): Reset CQ's tail to the end of the compressed queue.
Diffstat (limited to 'pflocal/connq.c')
-rw-r--r-- | pflocal/connq.c | 11 |
1 files changed, 7 insertions, 4 deletions
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"); |