From ec0e0ef8a6eecf777887c3377a968c96c9b95968 Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Wed, 17 Nov 2010 18:13:19 +0900 Subject: [PATCH] Do not start mod_proxy65 if it is unable to bind an address (EJAB-1336) --- src/mod_proxy65/mod_proxy65.erl | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/mod_proxy65/mod_proxy65.erl b/src/mod_proxy65/mod_proxy65.erl index 27e723c96..bd0d54bb7 100644 --- a/src/mod_proxy65/mod_proxy65.erl +++ b/src/mod_proxy65/mod_proxy65.erl @@ -42,13 +42,17 @@ -define(PROCNAME, ejabberd_mod_proxy65). start(Host, Opts) -> - mod_proxy65_service:add_listener(Host, Opts), - Proc = gen_mod:get_module_proc(Host, ?PROCNAME), - ChildSpec = { - Proc, {?MODULE, start_link, [Host, Opts]}, - transient, infinity, supervisor, [?MODULE] - }, - supervisor:start_child(ejabberd_sup, ChildSpec). + case mod_proxy65_service:add_listener(Host, Opts) of + {error, _} = Err -> + erlang:error(Err); + _ -> + Proc = gen_mod:get_module_proc(Host, ?PROCNAME), + ChildSpec = { + Proc, {?MODULE, start_link, [Host, Opts]}, + transient, infinity, supervisor, [?MODULE] + }, + supervisor:start_child(ejabberd_sup, ChildSpec) + end. stop(Host) -> mod_proxy65_service:delete_listener(Host),