Module: kamailio
Branch: master
Commit: e2849f784159ef777c0fefd0e225e9940c896160
URL: 
https://github.com/kamailio/kamailio/commit/e2849f784159ef777c0fefd0e225e9940c896160

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-07-04T20:25:36+02:00

core: rpc exec locks get function returns the index

- function to release by index

---

Modified: src/core/rpc_lookup.c
Modified: src/core/rpc_lookup.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/e2849f784159ef777c0fefd0e225e9940c896160.diff
Patch: 
https://github.com/kamailio/kamailio/commit/e2849f784159ef777c0fefd0e225e9940c896160.patch

---

diff --git a/src/core/rpc_lookup.c b/src/core/rpc_lookup.c
index 72286634f52..793905ae03a 100644
--- a/src/core/rpc_lookup.c
+++ b/src/core/rpc_lookup.c
@@ -80,20 +80,23 @@ void ksr_rpc_exec_locks_set_destroy(void)
 /**
  *
  */
-void ksr_rpc_exec_locks_set_get(str *name)
+int ksr_rpc_exec_locks_set_get(str *name)
 {
        unsigned int lockidx = 0;
 
        if(likely(ksr_rpc_exec_locks_set == NULL)) {
-               return;
+               return -1;
        }
 
        if(name == NULL || name->s == NULL || name->len <= 0) {
-               return;
+               return -1;
        }
+
        lockidx = get_hash1_raw(name->s, name->len);
        lockidx = lockidx % ksr_rpc_exec_locks;
        rec_lock_set_get(ksr_rpc_exec_locks_set, lockidx);
+
+       return (int)lockidx;
 }
 
 /**
@@ -116,6 +119,26 @@ void ksr_rpc_exec_locks_set_release(str *name)
        rec_lock_set_release(ksr_rpc_exec_locks_set, lockidx);
 }
 
+/**
+ *
+ */
+void ksr_rpc_exec_locks_set_release_idx(int idx)
+{
+       unsigned int lockidx = 0;
+
+       if(likely(ksr_rpc_exec_locks_set == NULL)) {
+               return;
+       }
+
+       if(idx < 0) {
+               return;
+       }
+
+       lockidx = (unsigned int)idx;
+       lockidx = lockidx % ksr_rpc_exec_locks;
+       rec_lock_set_release(ksr_rpc_exec_locks_set, lockidx);
+}
+
 /** init the rpc hash table.
  * @return 0 on success, -1 on error
  */
diff --git a/src/core/rpc_lookup.h b/src/core/rpc_lookup.h
index 7016b790da3..60770a2bb37 100644
--- a/src/core/rpc_lookup.h
+++ b/src/core/rpc_lookup.h
@@ -39,8 +39,9 @@ int rpc_register(rpc_export_t *rpc);
 int rpc_register_array(rpc_export_t *rpc_array);
 
 int ksr_rpc_exec_locks_set_init(void);
-void ksr_rpc_exec_locks_set_get(str *name);
+int ksr_rpc_exec_locks_set_get(str *name);
 void ksr_rpc_exec_locks_set_release(str *name);
+void ksr_rpc_exec_locks_set_release_idx(int idx);
 
 #endif /*_RPC_LOOKUP_H_*/
 

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to