From 5edea6a09b57dc818acc966c6f5bfe21bc8a9c71 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 16 Jul 2018 08:30:59 +0200 Subject: [PATCH] use more assertions to check node state machine --- lib/node.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node.c b/lib/node.c index e217d0ee7..c06b3160a 100644 --- a/lib/node.c +++ b/lib/node.c @@ -416,8 +416,8 @@ int node_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *rel { int readd, nread = 0; - if (!n->_vt->read) - return -1; + assert(n->state == STATE_STARTED); + assert(node_type(n)->read); /* Send in parts if vector not supported */ if (node_type(n)->vectorize > 0 && node_type(n)->vectorize < cnt) { @@ -478,8 +478,8 @@ int node_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *re { int sent, nsent = 0; - if (!n->_vt->write) - return -1; + assert(n->state == STATE_STARTED); + assert(node_type(n)->write); #ifdef WITH_HOOKS /* Run write hooks */