summaryrefslogtreecommitdiff
path: root/mesh/mesh.c
diff options
context:
space:
mode:
authorMichaƂ Lowas-Rzechonek <michal.lowas-rzechonek@silvair.com>2019-05-08 16:24:45 +0200
committerBrian Gix <brian.gix@intel.com>2019-05-08 11:31:18 -0700
commit64670a4a31d53fe8b5b801ab1f8659e3d0ed2000 (patch)
tree6b402c828d0403e1a9935c147a8a221c54b80c3f /mesh/mesh.c
parent08c45ed6805c09e3d3e4aa3e61898a28460d8fa0 (diff)
downloadbluez-64670a4a31d53fe8b5b801ab1f8659e3d0ed2000.tar.gz
mesh: Use node uuids as storage directory names
Instead of keeping track of unique 16bit node identifiers, reuse their UUIDs to create both storage directories and dbus objects. Because of that: - UUID is no longer stored in the JSON file, it's inferred from the directory name instead - Join(), CreateNetwork() and ImportLocalNode() APIs return an error if given UUID already registered within the daemon
Diffstat (limited to 'mesh/mesh.c')
-rw-r--r--mesh/mesh.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mesh/mesh.c b/mesh/mesh.c
index a084f9200..4d65f266a 100644
--- a/mesh/mesh.c
+++ b/mesh/mesh.c
@@ -577,6 +577,13 @@ static struct l_dbus_message *join_network_call(struct l_dbus *dbus,
"Bad device UUID");
}
+ if (node_find_by_uuid(join_pending->uuid)) {
+ l_free(join_pending);
+ join_pending = NULL;
+ return dbus_error(msg, MESH_ERROR_ALREADY_EXISTS,
+ "Node already exists");
+ }
+
sender = l_dbus_message_get_sender(msg);
join_pending->sender = l_strdup(sender);