From 1c9604e9d07c8926464fc33404d01ca652949d6c Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 24 Feb 2014 04:28:25 -0600 Subject: [PATCH] FS-1307 Don't load event socket on bind error --- conf/vanilla/autoload_configs/event_socket.conf.xml | 1 + src/mod/event_handlers/mod_event_socket/mod_event_socket.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/conf/vanilla/autoload_configs/event_socket.conf.xml b/conf/vanilla/autoload_configs/event_socket.conf.xml index 5ea2e09788..28e0f46837 100644 --- a/conf/vanilla/autoload_configs/event_socket.conf.xml +++ b/conf/vanilla/autoload_configs/event_socket.conf.xml @@ -5,5 +5,6 @@ + diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 12bf9a21b0..8ba47adfd6 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -127,6 +127,7 @@ static struct { uint32_t acl_count; uint32_t id; int nat_map; + int stop_on_bind_error; } prefs; @@ -2740,6 +2741,8 @@ static int config(void) } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Max acl records of %d reached\n", MAX_ACL); } + } else if (!strcasecmp(var, "stop-on-bind-error")) { + prefs.stop_on_bind_error = switch_true(val) ? 1 : 0; } } } @@ -2819,6 +2822,10 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime) break; sock_fail: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error! Could not listen on %s:%u\n", prefs.ip, prefs.port); + if (prefs.stop_on_bind_error) { + prefs.done = 1; + goto fail; + } switch_yield(100000); }