diff options
author | Inga Stotland <inga.stotland@intel.com> | 2020-05-21 17:34:59 -0700 |
---|---|---|
committer | Brian Gix <brian.gix@intel.com> | 2020-05-22 13:45:53 -0700 |
commit | 7a5007178f95e2f3afa90aa7a57da10b1db7f47b (patch) | |
tree | 60ab72b49f2b8a4790acfab0e537f04799ee0fd7 /mesh/node.c | |
parent | 1b7d879555426178f79cd8493bd599b0689527a8 (diff) | |
download | bluez-7a5007178f95e2f3afa90aa7a57da10b1db7f47b.tar.gz |
mesh: Clean up Attach() method call
This consolidates error return form one place: off a callback
with unsuccessful status.
Diffstat (limited to 'mesh/node.c')
-rw-r--r-- | mesh/node.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/mesh/node.c b/mesh/node.c index 9ba5ad877..dd28dfd77 100644 --- a/mesh/node.c +++ b/mesh/node.c @@ -1634,20 +1634,23 @@ fail: } /* Establish relationship between application and mesh node */ -int node_attach(const char *app_root, const char *sender, uint64_t token, +void node_attach(const char *app_root, const char *sender, uint64_t token, node_ready_func_t cb, void *user_data) { struct managed_obj_request *req; struct mesh_node *node; node = l_queue_find(nodes, match_token, (void *) &token); - if (!node) - return MESH_ERROR_NOT_FOUND; + if (!node) { + cb(user_data, MESH_ERROR_NOT_FOUND, NULL); + return; + } /* Check if the node is already in use */ if (node->owner) { l_warn("The node is already in use"); - return MESH_ERROR_ALREADY_EXISTS; + cb(user_data, MESH_ERROR_ALREADY_EXISTS, NULL); + return; } req = l_new(struct managed_obj_request, 1); @@ -1668,11 +1671,8 @@ int node_attach(const char *app_root, const char *sender, uint64_t token, "GetManagedObjects", NULL, get_managed_objects_cb, req, l_free); - return MESH_ERROR_NONE; - } - /* Create a temporary pre-provisioned node */ void node_join(const char *app_root, const char *sender, const uint8_t *uuid, node_join_ready_func_t cb) |