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

FreeSWITCH SVN andrew at freeswitch.org
Fri Nov 7 16:43:55 PST 2008


Author: andrew
Date: Fri Nov  7 19:43:55 2008
New Revision: 10302

Modified:
   freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c

Log:
Try to start epmd (erlang port mapper daemon) if ei_publish fails


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	Fri Nov  7 19:43:55 2008
@@ -1199,10 +1199,17 @@
 
 	/* return value is -1 for error, a descriptor pointing to epmd otherwise */
 	if ((epmdfd = ei_publish(&ec, prefs.port)) == -1) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to publish port to empd\n");
-		/* TODO - start epmd? */
-		close_socket(&listen_list.sockfd);
-		return SWITCH_STATUS_GENERR;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to publish port to empd, trying to start empd manually\n");
+		if (system("epmd -daemon")) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to start empd manually\n");
+			close_socket(&listen_list.sockfd);
+			return SWITCH_STATUS_GENERR;
+		}
+		if ((epmdfd = ei_publish(&ec, prefs.port)) == -1) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to publish port to empd AGAIN\n");
+			close_socket(&listen_list.sockfd);
+			return SWITCH_STATUS_GENERR;
+		}
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connected and published erlang cnode at %s port %u\n", thisnodename, prefs.port);



More information about the Freeswitch-svn mailing list