diff --git a/doc/mesh-api.txt b/doc/mesh-api.txt
index 0b341a0..0fc0896 100644
--- a/doc/mesh-api.txt
+++ b/doc/mesh-api.txt
PossibleErrors:
org.bluez.mesh.Error.InvalidArguments
org.bluez.mesh.Error.NotFound,
+ org.bluez.mesh.Error.AlreadyExists,
org.bluez.mesh.Error.Failed
void Leave(uint64 token)
diff --git a/mesh/node.c b/mesh/node.c
index dae9a4b..820aeb4 100644
--- a/mesh/node.c
+++ b/mesh/node.c
if (!node)
return MESH_ERROR_NOT_FOUND;
- /* TODO: decide what to do if previous node->app_path is not NULL */
- node->app_path = l_strdup(app_path);
+ /* Check if the node is already in use */
+ if (node->owner) {
+ l_warn("The node is already in use");
+ return MESH_ERROR_ALREADY_EXISTS;
+ }
+ node->app_path = l_strdup(app_path);
node->owner = l_strdup(sender);
req = l_new(struct attach_obj_request, 1);