[sr-dev] git:master:82845eac: db_cluster: Add RPC success and error messages to dbcl_rpc_enable_connection

Olle E. Johansson oej at edvina.net
Mon Jan 3 15:41:27 CET 2022


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

Author: Olle E. Johansson <oej at edvina.net>
Committer: Olle E. Johansson <oej at edvina.net>
Date: 2022-01-03T15:41:10+01:00

db_cluster: Add RPC success and error messages to dbcl_rpc_enable_connection

---

Modified: src/modules/db_cluster/db_cluster_mod.c

---

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

---

diff --git a/src/modules/db_cluster/db_cluster_mod.c b/src/modules/db_cluster/db_cluster_mod.c
index d4aae0e123..2ddbffc2ad 100644
--- a/src/modules/db_cluster/db_cluster_mod.c
+++ b/src/modules/db_cluster/db_cluster_mod.c
@@ -309,6 +309,7 @@ static void dbcl_rpc_enable_connection(rpc_t *rpc, void *c)
 	if(cls==NULL)
 	{   
 		LM_INFO("cluster not found [%.*s]\n", cluster.len, cluster.s);
+		rpc->fault(c, 500, "Cluster not found");
 		return;
 	}
 
@@ -317,11 +318,14 @@ static void dbcl_rpc_enable_connection(rpc_t *rpc, void *c)
 	if(con==NULL)
 	{   
 		LM_INFO("connection not found [%.*s]\n", connection.len, connection.s);
+		rpc->fault(c, 500, "Cluster connection not found");
 		return;
 	}
-
-	dbcl_enable_con(con);
-
+	if(dbcl_enable_con(con) < 0) {
+		rpc->fault(c, 500, "Failed to enable cluster connection.");
+		return;
+	}
+	rpc->rpl_printf(c, "Ok. Cluster connection enabled.");
 	return;
 }
 




More information about the sr-dev mailing list