提交 f6a96893 authored 作者: Andrew Thompson's avatar Andrew Thompson

Bind to 0.0.0.0 instead of 127.0.0.1 by default; like most erlang nodes do.


git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12249 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 333019eb
......@@ -316,6 +316,9 @@ switch_status_t initialise_ei(struct ei_cnode_s *ec)
{
switch_status_t rv;
struct sockaddr_in server_addr;
struct hostent *nodehost;
char thishostname[EI_MAXHOSTNAMELEN+1] = "";
char thisnodename[MAXNODELEN+1];
/* zero out the struct before we use it */
memset(&server_addr, 0, sizeof(server_addr));
......@@ -334,14 +337,13 @@ switch_status_t initialise_ei(struct ei_cnode_s *ec)
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(prefs.port);
struct hostent *nodehost = gethostbyaddr(&server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET);
char *thishostname = nodehost->h_name;
char thisnodename[MAXNODELEN+1];
if ((nodehost = gethostbyaddr(&server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET)))
memcpy(thishostname, nodehost->h_name, EI_MAXHOSTNAMELEN);
if (!strcmp(thishostname, "localhost"))
if (switch_strlen_zero_buf(thishostname)) {
gethostname(thishostname, EI_MAXHOSTNAMELEN);
}
if (prefs.shortname) {
char *off;
if ((off = strchr(thishostname, '.'))) {
......
<configuration name="erlang_event.conf" description="Erlang Socket Client">
<settings>
<param name="listen-ip" value="127.0.0.1"/>
<param name="listen-ip" value="0.0.0.0"/>
<param name="listen-port" value="8031"/>
<param name="cookie" value="ClueCon"/>
<param name="shortname" value="true"/>
......
......@@ -932,7 +932,7 @@ static int config(void)
}
if (switch_strlen_zero(prefs.ip)) {
set_pref_ip("127.0.0.1");
set_pref_ip("0.0.0.0");
}
if (switch_strlen_zero(prefs.cookie)) {
......@@ -1423,7 +1423,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_erlang_event_runtime)
}
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connected and published erlang cnode at %s\n", ec.thisnodename);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connected to epmd and published erlang cnode at %s\n", ec.thisnodename);
listen_list.ready = 1;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论