summaryrefslogtreecommitdiffstats
path: root/src/queue.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-03-02 20:12:59 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-03-02 20:12:59 +0100
commitebd9d98fd7a2c08f57b1187a7b9efafbfbb63fe7 (patch)
tree707d1bfe6c1da4032f3859ee2b514ff5927a72c2 /src/queue.c
parent3a4964f5e8c07943474036e594698b313a73d502 (diff)
downloadfastd-ebd9d98fd7a2c08f57b1187a7b9efafbfbb63fe7.tar
fastd-ebd9d98fd7a2c08f57b1187a7b9efafbfbb63fe7.zip
Delete pending tasks for deleted peers
Diffstat (limited to 'src/queue.c')
-rw-r--r--src/queue.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/queue.c b/src/queue.c
index 87ca255..e0e25e1 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -87,3 +87,17 @@ int fastd_queue_timeout(fastd_queue *queue) {
else
return (int)diff_msec;
}
+
+void fastd_queue_filter(fastd_queue *queue, bool (*pred)(void*, void*), void *extra) {
+ fastd_queue_entry **entry;
+ for (entry = &queue->head; *entry; ) {
+ if (!pred((*entry)->data, extra)) {
+ fastd_queue_entry *cur = *entry;
+ *entry = cur->next;
+ free(cur);
+ }
+ else {
+ entry = &(*entry)->next;
+ }
+ }
+}