[Freeswitch-svn] [commit] r12249 - freeswitch/trunk/src/mod/event_handlers/mod_erlang_event

FreeSWITCH SVN andrew at freeswitch.org
Mon Feb 23 10:34:08 PST 2009


Author: andrew
Date: Mon Feb 23 12:34:08 2009
New Revision: 12249

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


Modified:
   freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/ei_helpers.c
   freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml
   freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c

Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/ei_helpers.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/ei_helpers.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/ei_helpers.c	Mon Feb 23 12:34:08 2009
@@ -316,6 +316,9 @@
 {
 	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 @@
 	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, '.'))) {

Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml	Mon Feb 23 12:34:08 2009
@@ -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"/>

Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	Mon Feb 23 12:34:08 2009
@@ -932,7 +932,7 @@
 	}
 
 	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_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;
 



More information about the Freeswitch-svn mailing list