[sr-dev] git:master:72c21719: kazoo : code cleanup

Luis Azedo luis at 2600hz.com
Fri Mar 3 21:06:24 CET 2017


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

Author: Luis Azedo <luis at 2600hz.com>
Committer: Luis Azedo <luis at 2600hz.com>
Date: 2017-03-03T20:05:43Z

kazoo : code cleanup

---

Modified: src/modules/kazoo/kazoo.c
Modified: src/modules/kazoo/kz_amqp.h

---

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

---

diff --git a/src/modules/kazoo/kazoo.c b/src/modules/kazoo/kazoo.c
index bf35a5f..5c81ad2 100644
--- a/src/modules/kazoo/kazoo.c
+++ b/src/modules/kazoo/kazoo.c
@@ -41,6 +41,8 @@
 #define DBK_DEFAULT_NO_CONSUMERS 1
 #define DBK_DEFAULT_NO_WORKERS 8
 
+#define AMQP_WORKERS_RANKING PROC_XWORKER
+
 static int mod_init(void);
 static int  mod_child_init(int rank);
 static int fire_init_event(int rank);
@@ -352,27 +354,15 @@ static int mod_child_init(int rank)
 	kz_amqp_zone_ptr g;
 	kz_amqp_server_ptr s;
 
-	fire_init_event(rank);
+	if (rank==PROC_INIT)
+		fire_init_event(rank);
 
 	if (rank==PROC_INIT || rank==PROC_TCP_MAIN)
 		return 0;
 
-//	if (rank>PROC_MAIN)
-//		kz_cmd_pipe = kz_cmd_pipe_fds[1];
-
-
 	if (rank==PROC_MAIN) {
-		/*
-		pid=fork_process(PROC_NOCHLDINIT, "AMQP Timer", 0);
-		if (pid<0)
-			return -1;
-		if(pid==0){
-			return(kz_amqp_timeout_proc());
-		}
-		*/
-
 		for(i=0; i < dbk_consumer_workers; i++) {
-			pid=fork_process(PROC_XWORKER, "AMQP Consumer Worker", 1);
+			pid=fork_process(AMQP_WORKERS_RANKING, "AMQP Consumer Worker", 1);
 			if (pid<0)
 				return -1; /* error */
 			if(pid==0){
@@ -408,7 +398,7 @@ static int mod_child_init(int rank)
 		return 0;
 	}
 
-	if(dbk_pua_mode == 1) {
+	if(rank == AMQP_WORKERS_RANKING && dbk_pua_mode == 1) {
 		if (kz_pa_dbf.init==0)
 		{
 			LM_CRIT("child_init: database not bound\n");
diff --git a/src/modules/kazoo/kz_amqp.h b/src/modules/kazoo/kz_amqp.h
index aa07640..0e5d668 100644
--- a/src/modules/kazoo/kz_amqp.h
+++ b/src/modules/kazoo/kz_amqp.h
@@ -80,16 +80,8 @@ extern int dbk_consumer_workers;
 typedef struct kz_amqp_connection_t {
 	kz_amqp_connection_info info;
 	char* url;
-//    struct kz_amqp_connection_t* next;
 } kz_amqp_connection, *kz_amqp_connection_ptr;
 
-/*
-typedef struct {
-	kz_amqp_connection_ptr current;
-	kz_amqp_connection_ptr head;
-	kz_amqp_connection_ptr tail;
-} kz_amqp_connection_pool, *kz_amqp_connection_pool_ptr;
-*/
 typedef struct kz_amqp_conn_t {
 	struct kz_amqp_server_t* server;
 	amqp_connection_state_t conn;
@@ -99,7 +91,6 @@ typedef struct kz_amqp_conn_t {
 	amqp_socket_t *socket;
 	amqp_channel_t channel_count;
 	amqp_channel_t channel_counter;
-//    struct kz_amqp_conn_t* next;
 } kz_amqp_conn, *kz_amqp_conn_ptr;
 
 typedef struct {
@@ -133,10 +124,6 @@ typedef struct {
 	amqp_channel_t channel;
 	struct timeval timeout;
 
-	/* timer */
-//	struct event *timer_ev;
-//	int timerfd;
-
 	/* async */
 	char *cb_route;
 	char *err_route;




More information about the sr-dev mailing list