diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-03-26 09:20:22 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-03-26 09:22:38 +0100 |
commit | 99a263ff20e6b2bbeddbbbc4e0a1acbec1d5dd79 (patch) | |
tree | 750faf534c06a202bf1ba3bf5bcd59c19467ed93 /src | |
parent | 52b4abdcb351830f5493a50c4181ef3947f3feab (diff) |
write_queue: Add a method to clear the queue.
Diffstat (limited to 'src')
-rw-r--r-- | src/write_queue.c | 11 |
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; +} |