List pagination locking for state-data changes

Changed semantics of locking: instead of relying of locking running-db,
an automatic lock bound to a session is maintained. When the session closes
the lock is released.
This commit is contained in:
Olof hagsand 2021-10-28 14:49:33 +02:00
parent 197fc16e69
commit eea6d549f6
5 changed files with 25 additions and 19 deletions

View file

@ -919,7 +919,6 @@ cli_pagination(clicon_handle h,
uint32_t limit = 0;
cxobj **xvec = NULL;
size_t xlen;
int locked = 0;
if (cvec_len(argv) != 5){
clicon_err(OE_PLUGIN, 0, "Expected usage: <xpath> <prefix> <namespace> <format> <limit>");
@ -949,9 +948,6 @@ cli_pagination(clicon_handle h,
}
if ((nsc = xml_nsctx_init(prefix, namespace)) == NULL)
goto done;
if (clicon_rpc_lock(h, "running") < 0)
goto done;
locked++;
for (i = 0;; i++){
if (clicon_rpc_get_pageable_list(h, "running", xpath, nsc,
CONTENT_ALL,
@ -1004,8 +1000,6 @@ cli_pagination(clicon_handle h,
} /* for i */
retval = 0;
done:
if (locked)
clicon_rpc_unlock(h, "running");
if (xvec)
free(xvec);
if (xret)