[sr-dev] git:master:6f268b5a: erlang: fix register server process with the local name server epmd

Seudin Kasumovic seudin.kasumovic at gmail.com
Wed Apr 13 08:49:59 CEST 2016


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

Author: Seudin Kasumovic <seudin.kasumovic at gmail.com>
Committer: Seudin Kasumovic <seudin.kasumovic at gmail.com>
Date: 2016-04-13T08:44:09+02:00

erlang: fix register server process with the local name server epmd

- use correct alive name when number of C nodes greater then 1
- fix error check on register server process

---

Modified: modules/erlang/cnode.c
Modified: modules/erlang/epmd.c
Modified: modules/erlang/epmd.h
Modified: modules/erlang/erl_helpers.c

---

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

---

diff --git a/modules/erlang/cnode.c b/modules/erlang/cnode.c
index f0f6e03..1e9b5d6 100644
--- a/modules/erlang/cnode.c
+++ b/modules/erlang/cnode.c
@@ -226,7 +226,7 @@ int init_cnode_sockets(int cnode_id)
 	io_handler_ins(phandler);
 
 	/* start epmd handler - publish Kamailo C node */
-	if (epmd_init((epmd_handler_t*)phandler) < 0 ) {
+	if (epmd_init((epmd_handler_t*)phandler, &alivename) < 0 ) {
 		return -1;
 	}
 
diff --git a/modules/erlang/epmd.c b/modules/erlang/epmd.c
index 3a47e0f..43889aa 100644
--- a/modules/erlang/epmd.c
+++ b/modules/erlang/epmd.c
@@ -39,9 +39,9 @@
 /**
  * \brief Initialize EPMD handler
  */
-int epmd_init(epmd_handler_t *epmd)
+int epmd_init(epmd_handler_t *epmd, str *alivename)
 {
-	epmd->sockfd = erl_init_node(&epmd->ec, &cnode_alivename, &cnode_host, &cookie);
+	epmd->sockfd = erl_init_node(&epmd->ec, alivename, &cnode_host, &cookie);
 	epmd->handle_f = handle_epmd;
 	epmd->wait_tmo_f = NULL;
 	epmd->destroy_f  = NULL;
diff --git a/modules/erlang/epmd.h b/modules/erlang/epmd.h
index d5d4507..09b3eb5 100644
--- a/modules/erlang/epmd.h
+++ b/modules/erlang/epmd.h
@@ -55,7 +55,7 @@ typedef struct epmd_handler_s
 
 } epmd_handler_t;
 
-int epmd_init(epmd_handler_t *epmd);
+int epmd_init(epmd_handler_t *epmd, str *alivename);
 int handle_epmd(handler_common_t *phandler);
 
 #endif /* EPMD_H_ */
diff --git a/modules/erlang/erl_helpers.c b/modules/erlang/erl_helpers.c
index cc43e92..f702a8b 100644
--- a/modules/erlang/erl_helpers.c
+++ b/modules/erlang/erl_helpers.c
@@ -307,9 +307,9 @@ int erl_init_node(ei_cnode *ec, const str *alivename, const str *hostname, const
 	sockaddr2ip_addr(&ip, addr);
 
 	/* publish */
-	if ((epmdfd = ei_publish_tmo(ec, port, timeout_ms)) == -1) {
+	if ((epmdfd = ei_publish_tmo(ec, port, timeout_ms)) < 0) {
 
-		LM_ERR("Failed to publish port %u to epmd, check is epmd started\n", port);
+		LM_DBG("Failed publish %s:%u[%u] as %s: %s (%d)\n",ip_addr2strz(&ip),port,listen_fd,nodename, strerror(erl_errno), epmdfd);
 
 		erl_close_socket(listen_fd);
 		return -1;




More information about the sr-dev mailing list