From 8b18bd35e04f8506ff4250ad43bf6075f98692b2 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 12 May 2018 18:03:40 +0200 Subject: [PATCH] file: destroy IO in file_destroy() instead of file_stop() --- lib/nodes/file.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/nodes/file.c b/lib/nodes/file.c index cc642caf4..674c0bd0b 100644 --- a/lib/nodes/file.c +++ b/lib/nodes/file.c @@ -250,21 +250,31 @@ int file_start(struct node *n) int file_stop(struct node *n) { - struct file *f = (struct file *) n->_vd; int ret; + struct file *f = (struct file *) n->_vd; - task_destroy(&f->task); + ret = task_destroy(&f->task); + if (ret) + return ret; ret = io_close(&f->io); if (ret) return ret; + free(f->uri); + + return 0; +} + +int file_destroy(struct node *n) +{ + int ret; + struct file *f = (struct file *) n->_vd; + ret = io_destroy(&f->io); if (ret) return ret; - free(f->uri); - return 0; } @@ -371,6 +381,7 @@ static struct plugin p = { .print = file_print, .start = file_start, .stop = file_stop, + .destroy = file_destroy, .read = file_read, .write = file_write, .fd = file_fd