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

api: fix new node action in C++ code

This commit is contained in:
Steffen Vogel 2018-12-02 03:07:53 +01:00
parent eef7420579
commit 40265ffca8

View file

@ -24,10 +24,11 @@
#include <villas/plugin.h>
#include <villas/node.h>
#include <villas/super_node.h>
#include <villas/super_node.hpp>
#include <villas/utils.h>
#include <villas/stats.h>
#include <villas/api/session.hpp>
#include <villas/api/action.hpp>
#include <villas/api.hpp>
namespace villas {
@ -37,10 +38,9 @@ namespace api {
template<int (*A)(struct node *)>
class NodeAction : public Action {
proctected:
int action(struct node *n) = 0;
public:
using Action::Action;
virtual int execute(json_t *args, json_t **resp)
{
int ret;
@ -53,13 +53,13 @@ public:
if (ret)
return ret;
struct list *nodes = &s->api->super_node->nodes;
struct node *node = list_lookup(nodes, node_str);
struct list *nodes = session->getSuperNode()->getNodes();
struct node *n = (struct node *) list_lookup(nodes, node_str);
if (!node)
if (!n)
return -1;
return A(node);
return A(n);
}
};