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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-07-07T10:02:13+02:00

ctl: use rpc exec locks

---

Modified: src/modules/ctl/binrpc_run.c
Modified: src/modules/ctl/fifo_server.c

---

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

---

diff --git a/src/modules/ctl/binrpc_run.c b/src/modules/ctl/binrpc_run.c
index 9e57591bf16..9390aac0da8 100644
--- a/src/modules/ctl/binrpc_run.c
+++ b/src/modules/ctl/binrpc_run.c
@@ -642,6 +642,7 @@ int process_rpc_req(unsigned char *buf, int size, int 
*bytes_needed, void *sh,
        struct binrpc_ctx f_ctx;
        struct binrpc_parse_ctx *ctx;
        unsigned int rdata;
+       int lidx = -1;
 
        if(ksr_shutdown_phase()) {
                /* during shutdown - no more RPC command handling */
@@ -702,6 +703,7 @@ int process_rpc_req(unsigned char *buf, int size, int 
*bytes_needed, void *sh,
                goto end;
        }
        f_ctx.method = val.u.strval.s;
+       lidx = ksr_rpc_exec_locks_set_get(&val.u.strval);
        rpc_e->r.function(&binrpc_callbacks, &f_ctx);
        if(f_ctx.replied == 0) {
                if((binrpc_pkt_len(&f_ctx.out.pkt) == 0) && f_ctx.err_code
@@ -719,6 +721,7 @@ int process_rpc_req(unsigned char *buf, int size, int 
*bytes_needed, void *sh,
                        rpc_send(&f_ctx);
                }
        }
+       ksr_rpc_exec_locks_set_release_idx(lidx);
 end:
        *bytes_needed = 0; /* full read */
        destroy_binrpc_ctx(&f_ctx);
diff --git a/src/modules/ctl/fifo_server.c b/src/modules/ctl/fifo_server.c
index 868d2005ce9..4556e6ac464 100644
--- a/src/modules/ctl/fifo_server.c
+++ b/src/modules/ctl/fifo_server.c
@@ -742,6 +742,8 @@ int fifo_process(char *msg_buf, int size, int 
*bytes_needed, void *sh,
        int req_size;
        static rpc_ctx_t context;
        unsigned int rdata;
+       int lidx = -1;
+       str method;
 
        log_prefix_set(NULL);
        DBG("process_fifo: called with %d bytes, offset %d: %.*s\n", size,
@@ -825,7 +827,9 @@ int fifo_process(char *msg_buf, int size, int 
*bytes_needed, void *sh,
        /* make command zero-terminated */
        *file_sep = 0;
 
-       exp = rpc_lookupx(context.method, strlen(context.method), &rdata);
+       method.s = context.method;
+       method.len = strlen(context.method);
+       exp = rpc_lookupx(method.s, method.len, &rdata);
        if((exp == NULL) || (exp->r.function == NULL)) {
                DBG("Command %s not found\n", context.method);
                rpc_fault(&context, 500, "Command '%s' not found", 
context.method);
@@ -838,12 +842,14 @@ int fifo_process(char *msg_buf, int size, int 
*bytes_needed, void *sh,
                goto consume;
        }
 
+       lidx = ksr_rpc_exec_locks_set_get(&method);
        exp->r.function(&func_param, &context);
 
 consume:
        if(!context.reply_sent) {
                rpc_send(&context);
        }
+       ksr_rpc_exec_locks_set_release_idx(lidx);
 
        if(context.reply_file) {
                ctl_free(context.reply_file);

_______________________________________________
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