From 8f4466f197b7dcaa49150a01022e02fc855398ba Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 8 Jun 2020 20:04:51 +0200 Subject: Force parent id to -1 if root node of subscription. --- src/munia_proto.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/munia_proto.cc b/src/munia_proto.cc index dfc70d2..ef572e8 100644 --- a/src/munia_proto.cc +++ b/src/munia_proto.cc @@ -32,8 +32,9 @@ #include #include +#include -#include "hugin.hpp" +#include #include "node.h" #include "messageparser.h" @@ -231,6 +232,12 @@ int callback_lws_node(struct lws *wsi, node_t node = node_manager.node(*id); message_t createmsg = create_msg_create(node, -1); + if(id == ids.begin()) + { + assert(createmsg.cmd == cmd::create); // First message must always be a create of the root node + // Force the first node to have parent -1 + createmsg.create.parentid = -1; + } createmsg.tid = omi->subscribe.id; msgqueue[wsi].push_back(createmsg); -- cgit v1.2.3