From c0240e7249a2ba1f503c88581bce1edb3cad12e0 Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Sat, 2 Nov 2013 10:30:19 +1000 Subject: [PATCH] Do not try to start STUN application during config checks --- src/ejabberd_listener.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ejabberd_listener.erl b/src/ejabberd_listener.erl index 033eb0e0f..5dc26c68e 100644 --- a/src/ejabberd_listener.erl +++ b/src/ejabberd_listener.erl @@ -341,6 +341,7 @@ start_listener2(Port, Module, Opts) -> %% It is only required to start the supervisor in some cases. %% But it doesn't hurt to attempt to start it for any listener. %% So, it's normal (and harmless) that in most cases this call returns: {error, {already_started, pid()}} + maybe_start_stun(Module), start_module_sup(Port, Module), start_listener_sup(Port, Module, Opts). @@ -455,6 +456,12 @@ is_frontend(_) -> false. strip_frontend({frontend, Module}) -> Module; strip_frontend(Module) when is_atom(Module) -> Module. +-spec maybe_start_stun(module()) -> any(). + +maybe_start_stun(ejabberd_stun) -> + ejabberd:start_app(p1_stun); +maybe_start_stun(_) -> + ok. %%% %%% Check options @@ -636,7 +643,6 @@ prepare_ip(IP) when is_binary(IP) -> prepare_mod(ejabberd_stun) -> prepare_mod(stun); prepare_mod(stun) -> - ejabberd:start_app(p1_stun), stun; prepare_mod(Mod) when is_atom(Mod) -> Mod.