]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Try to start epmd (erlang port mapper daemon) if ei_publish fails
authorAndrew Thompson <andrew@hijacked.us>
Sat, 8 Nov 2008 00:43:55 +0000 (00:43 +0000)
committerAndrew Thompson <andrew@hijacked.us>
Sat, 8 Nov 2008 00:43:55 +0000 (00:43 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10302 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c

index 62ffc8bf7c16446b795661a97acba578fadf421c..7177917f61853793faf54016b21acbef26a62136 100644 (file)
@@ -1199,10 +1199,17 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_erlang_event_runtime)
 
        /* 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);