summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-06-08 20:04:51 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2020-06-08 20:04:51 +0200
commit8f4466f197b7dcaa49150a01022e02fc855398ba (patch)
treefe4efc09a05c03b6b1fb91063cf535e3fa3a3171
parent75d85549c6d2a5284593e20c21d61fc5d6200bca (diff)
Force parent id to -1 if root node of subscription.
-rw-r--r--src/munia_proto.cc9
1 files changed, 8 insertions, 1 deletions
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 <queue>
#include <map>
+#include <cassert>
-#include "hugin.hpp"
+#include <hugin.hpp>
#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);