summaryrefslogtreecommitdiff
path: root/lib/mgmt_be_client.c
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2025-01-05 00:29:05 -0500
committerChristian Hopps <chopps@labn.net>2025-01-06 08:07:41 -0500
commit9aa2b0487445c7127cac215b9b2dcb32a5c7692e (patch)
tree895f9659363a5bce03075a90b1162d0d92c8d03c /lib/mgmt_be_client.c
parent5ffa10aac1cb9e58d8113f43e2a105b4494a0c31 (diff)
lib: change and improve walk finish callback function API
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'lib/mgmt_be_client.c')
-rw-r--r--lib/mgmt_be_client.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/mgmt_be_client.c b/lib/mgmt_be_client.c
index f03006ad0e..031e0772b2 100644
--- a/lib/mgmt_be_client.c
+++ b/lib/mgmt_be_client.c
@@ -854,8 +854,15 @@ static enum nb_error be_client_send_tree_data_batch(const struct lyd_node *tree,
more = true;
ret = NB_OK;
}
- if (ret != NB_OK)
+ if (ret != NB_OK) {
+ if (be_client_send_error(client, args->txn_id, args->req_id, false, -EINVAL,
+ "BE client %s txn-id %Lu error fetching oper state %d",
+ client->name, args->txn_id, ret))
+ ret = NB_ERR;
+ else
+ ret = NB_OK;
goto done;
+ }
tree_msg = mgmt_msg_native_alloc_msg(struct mgmt_msg_tree_data, 0,
MTYPE_MSG_NATIVE_TREE_DATA);
@@ -870,20 +877,15 @@ static enum nb_error be_client_send_tree_data_batch(const struct lyd_node *tree,
(LYD_PRINT_SHRINK | LYD_PRINT_WD_EXPLICIT |
LYD_PRINT_WITHSIBLINGS));
if (err) {
- ret = NB_ERR;
- goto done;
+ mgmt_msg_native_free_msg(tree_msg);
+ /* We will be called again to send the error */
+ return NB_ERR;
}
(void)be_client_send_native_msg(client, tree_msg,
mgmt_msg_native_get_msg_len(tree_msg),
false);
-done:
mgmt_msg_native_free_msg(tree_msg);
- if (ret)
- be_client_send_error(client, args->txn_id, args->req_id, false,
- -EINVAL,
- "BE client %s txn-id %" PRIu64
- " error fetching oper state %d",
- client->name, args->txn_id, ret);
+done:
if (ret != NB_OK || !more)
XFREE(MTYPE_MGMTD_BE_GT_CB_ARGS, args);
return ret;