Ensure proper detect event route and lost connection in erl_reply.
@@ -514,6 +514,7 @@ int csockfd_init(csockfd_handler_t *phandler, const ei_cnode *ec)
csocket_handler = phandler;
+ csockfd = 0;
return 0;
}
@@ -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) {