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; switch_status_t rv;
struct sockaddr_in server_addr; 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 */ /* zero out the struct before we use it */
memset(&server_addr, 0, sizeof(server_addr)); 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_family = AF_INET;
server_addr.sin_port = htons(prefs.port); 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; if (switch_strlen_zero_buf(thishostname)) {
char thisnodename[MAXNODELEN+1];
if (!strcmp(thishostname, "localhost"))
gethostname(thishostname, EI_MAXHOSTNAMELEN); gethostname(thishostname, EI_MAXHOSTNAMELEN);
}
if (prefs.shortname) { if (prefs.shortname) {
char *off; char *off;

View File

@ -1,6 +1,6 @@
<configuration name="erlang_event.conf" description="Erlang Socket Client"> <configuration name="erlang_event.conf" description="Erlang Socket Client">
<settings> <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="listen-port" value="8031"/>
<param name="cookie" value="ClueCon"/> <param name="cookie" value="ClueCon"/>
<param name="shortname" value="true"/> <param name="shortname" value="true"/>

View File

@ -932,7 +932,7 @@ static int config(void)
} }
if (switch_strlen_zero(prefs.ip)) { 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)) { 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; listen_list.ready = 1;