From a856f1801f19fbce5d9054b4e2ef664622ed77b0 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 25 Feb 2022 09:56:15 -0500 Subject: [PATCH] node: minor cleanups --- include/villas/node.hpp | 5 +++++ lib/node.cpp | 2 +- lib/node_compat.cpp | 14 ++++++-------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/villas/node.hpp b/include/villas/node.hpp index 8bc52de20..88f022ff5 100644 --- a/include/villas/node.hpp +++ b/include/villas/node.hpp @@ -169,6 +169,11 @@ public: virtual int pause() { + if (state != State::STARTED) + return -1; + + logger->info("Pausing node"); + return 0; } diff --git a/lib/node.cpp b/lib/node.cpp index f081cf49c..94f7ec2a7 100644 --- a/lib/node.cpp +++ b/lib/node.cpp @@ -346,7 +346,7 @@ int Node::read(struct Sample * smps[], unsigned cnt) logger->debug("Received {} samples of which {} have been skipped", nread, skipped); } else - logger->debug( "Received {} samples", nread); + logger->debug("Received {} samples", nread); return rread; #else diff --git a/lib/node_compat.cpp b/lib/node_compat.cpp index b7d63f33c..8310fba0f 100644 --- a/lib/node_compat.cpp +++ b/lib/node_compat.cpp @@ -138,10 +138,9 @@ int NodeCompat::pause() { int ret; - if (state != State::STARTED) - return -1; - - logger->info("Pausing node"); + ret = Node::pause(); + if (ret) + return ret; ret = _vt->pause ? _vt->pause(this) @@ -156,10 +155,9 @@ int NodeCompat::resume() { int ret; - if (state != State::PAUSED) - return -1; - - logger->info("Resuming node"); + ret = Node::resume(); + if (ret) + return ret; ret = _vt->resume ? _vt->resume(this)