summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-03-26 09:20:22 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-03-26 09:22:38 +0100
commit99a263ff20e6b2bbeddbbbc4e0a1acbec1d5dd79 (patch)
tree750faf534c06a202bf1ba3bf5bcd59c19467ed93 /src
parent52b4abdcb351830f5493a50c4181ef3947f3feab (diff)
write_queue: Add a method to clear the queue.
Diffstat (limited to 'src')
-rw-r--r--src/write_queue.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/write_queue.c b/src/write_queue.c
index 7d908b4c..a0ac2d6f 100644
--- a/src/write_queue.c
+++ b/src/write_queue.c
@@ -72,3 +72,14 @@ int write_queue_enqueue(struct write_queue *queue, struct msgb *data)
return 0;
}
+
+void write_queue_clear(struct write_queue *queue)
+{
+ while (!llist_empty(&queue->msg_queue)) {
+ struct msgb *msg = msgb_dequeue(&queue->msg_queue);
+ msgb_free(msg);
+ }
+
+ queue->current_length = 0;
+ queue->bfd.when &= ~BSC_FD_WRITE;
+}