1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-30 00:00:11 +01:00

super_node: Fix configuration of idle_stop setting

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
Steffen Vogel 2024-05-23 19:26:10 +02:00
parent 84f0ea9cb5
commit 4b896a8d7c
2 changed files with 9 additions and 5 deletions

View file

@ -40,7 +40,7 @@ class SuperNode {
protected: protected:
enum State state; enum State state;
int idleStop; bool idleStop;
Logger logger; Logger logger;

View file

@ -29,7 +29,7 @@ using namespace villas;
using namespace villas::node; using namespace villas::node;
SuperNode::SuperNode() SuperNode::SuperNode()
: state(State::INITIALIZED), idleStop(-1), : state(State::INITIALIZED), idleStop(false),
#ifdef WITH_API #ifdef WITH_API
api(this), api(this),
#endif #endif
@ -80,7 +80,7 @@ void SuperNode::parse(json_t *root) {
json_error_t err; json_error_t err;
idleStop = 1; int stop = -1;
ret = ret =
json_unpack_ex(root, &err, 0, json_unpack_ex(root, &err, 0,
@ -89,11 +89,15 @@ void SuperNode::parse(json_t *root) {
"stats", &statsRate, "http", &json_http, "logging", "stats", &statsRate, "http", &json_http, "logging",
&json_logging, "nodes", &json_nodes, "paths", &json_paths, &json_logging, "nodes", &json_nodes, "paths", &json_paths,
"hugepages", &hugepages, "affinity", &affinity, "priority", "hugepages", &hugepages, "affinity", &affinity, "priority",
&priority, "idle_stop", &idleStop, "uuid", &uuid_str); &priority, "idle_stop", &stop, "uuid", &uuid_str);
if (ret) if (ret)
throw ConfigError(root, err, "node-config", throw ConfigError(root, err, "node-config",
"Unpacking top-level config failed"); "Unpacking top-level config failed");
if (stop >= 0) {
idleStop = stop > 0;
}
if (uuid_str) { if (uuid_str) {
ret = uuid_parse(uuid_str, uuid); ret = uuid_parse(uuid_str, uuid);
if (ret) if (ret)
@ -455,7 +459,7 @@ int SuperNode::periodic() {
} }
} }
if (idleStop > 0 && state == State::STARTED && started == 0) { if (idleStop && state == State::STARTED && started == 0) {
logger->info("No more active paths. Stopping super-node"); logger->info("No more active paths. Stopping super-node");
return -1; return -1;