[sr-dev] git:master:75ba3ef0: erlang: Fix detecting event route

Seudin Kasumovic seudin.kasumovic at gmail.com
Fri May 22 22:07:31 CEST 2015


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

Author: Seudin Kasumovic <seudin at bicomsystems.com>
Committer: Seudin Kasumovic <seudin.kasumovic at gmail.com>
Date: 2015-05-22T22:03:40+02:00

erlang: Fix detecting event route

Ensure proper detect event route and lost connection in erl_reply.

---

Modified: modules/erlang/cnode.c
Modified: modules/erlang/erl_api.c

---

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

---

diff --git a/modules/erlang/cnode.c b/modules/erlang/cnode.c
index 6cc2786..d18f043 100644
--- a/modules/erlang/cnode.c
+++ b/modules/erlang/cnode.c
@@ -514,6 +514,7 @@ int csockfd_init(csockfd_handler_t *phandler, const ei_cnode *ec)
 
 	csocket_handler = phandler;
 
+	csockfd = 0;
 	return 0;
 }
 
diff --git a/modules/erlang/erl_api.c b/modules/erlang/erl_api.c
index 36cd1ed..0c5d15b 100644
--- a/modules/erlang/erl_api.c
+++ b/modules/erlang/erl_api.c
@@ -236,9 +236,12 @@ int _impl_reply(const ei_x_buff *msg)
 
 	/* must be in call back / event route */
 
-	if (!enode) {
+	if (csockfd) {
 		LM_ERR("not in callback\n");
 		return -1;
+	} else if (!enode) {
+		LM_ERR("not connected\n");
+		return -1;
 	}
 	/* copy into reply */
 	if (enode->response.buffsz < msg->buffsz) {




More information about the sr-dev mailing list