From ca817a6907d5538eea33aa830ef01d57ed7b6ad8 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 12 Feb 2019 15:07:50 +0100 Subject: [PATCH] tests: fix api-stress --- etc/loopback.json | 2 ++ include/villas/super_node.hpp | 2 ++ lib/super_node.cpp | 10 +++++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/etc/loopback.json b/etc/loopback.json index 2fb152a2f..54929849a 100644 --- a/etc/loopback.json +++ b/etc/loopback.json @@ -1,4 +1,6 @@ { + "idle_stop" : false, + "http" : { "port" : 8080 }, diff --git a/include/villas/super_node.hpp b/include/villas/super_node.hpp index 81b415e8d..805832d74 100644 --- a/include/villas/super_node.hpp +++ b/include/villas/super_node.hpp @@ -40,6 +40,8 @@ class SuperNode { protected: enum state state; + int idleStop; + int priority; /**< Process priority (lower is better) */ int affinity; /**< Process affinity of the server and all created threads */ int hugepages; /**< Number of hugepages to reserve. */ diff --git a/lib/super_node.cpp b/lib/super_node.cpp index 66eeb10e8..b1bb48621 100644 --- a/lib/super_node.cpp +++ b/lib/super_node.cpp @@ -49,6 +49,7 @@ using namespace villas::node; SuperNode::SuperNode() : state(STATE_INITIALIZED), + idleStop(false), priority(0), affinity(0), hugepages(DEFAULT_NR_HUGEPAGES), @@ -178,7 +179,9 @@ int SuperNode::parseJson(json_t *j) json_error_t err; - ret = json_unpack_ex(j, &err, 0, "{ s?: o, s?: o, s?: o, s?: o, s?: i, s?: i, s?: i, s?: s }", + idleStop = true; + + ret = json_unpack_ex(j, &err, 0, "{ s?: o, s?: o, s?: o, s?: o, s?: i, s?: i, s?: i, s?: s, s?: b }", "http", &json_web, "logging", &json_logging, "nodes", &json_nodes, @@ -186,7 +189,8 @@ int SuperNode::parseJson(json_t *j) "hugepages", &hugepages, "affinity", &affinity, "priority", &priority, - "name", &nme + "name", &nme, + "idle_stop", &idleStop ); if (ret) throw JsonError(err, "Failed to parse global configuration"); @@ -560,7 +564,7 @@ int SuperNode::periodic() #endif /* WITH_HOOKS */ } - if (state == STATE_STARTED && started == 0) { + if (idleStop && state == STATE_STARTED && started == 0) { info("No more active paths. Stopping super-node"); return -1;