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
This commit is contained in:
Andrew Thompson 2009-02-23 18:34:08 +00:00
parent 333019eb6a
commit f6a96893db
3 changed files with 11 additions and 9 deletions

View File

@ -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,13 +337,12 @@ 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);
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);
char *thishostname = nodehost->h_name;
char thisnodename[MAXNODELEN+1];
if (!strcmp(thishostname, "localhost"))
if (switch_strlen_zero_buf(thishostname)) {
gethostname(thishostname, EI_MAXHOSTNAMELEN);
}
if (prefs.shortname) {
char *off;

View File

@ -1,6 +1,6 @@
<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"/>

View File

@ -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;