mirror of
https://github.com/processone/ejabberd.git
synced 2025-01-01 17:53:00 +01:00
* src/ejabberd_listener.erl: Report error at startup if a listener
module isn't available or is not an ejabberd listener (EJAB-868) SVN Revision: 1875
This commit is contained in:
parent
d0fc8fe056
commit
70e431787e
@ -1,3 +1,8 @@
|
||||
2009-02-14 Badlop <badlop@process-one.net>
|
||||
|
||||
* src/ejabberd_listener.erl: Report error at startup if a listener
|
||||
module isn't available or is not an ejabberd listener (EJAB-868)
|
||||
|
||||
2009-02-13 Badlop <badlop@process-one.net>
|
||||
|
||||
* src/mod_shared_roster.erl: Fix bug: a pending subscription
|
||||
|
@ -56,7 +56,12 @@ start_listeners() ->
|
||||
Ls ->
|
||||
Ls2 = lists:map(
|
||||
fun({Port, Module, Opts}) ->
|
||||
start_listener(Port, Module, Opts)
|
||||
case start_listener(Port, Module, Opts) of
|
||||
{ok, _Pid} = R -> R;
|
||||
{error, Error} ->
|
||||
?ERROR_MSG(Error, []),
|
||||
throw(Error)
|
||||
end
|
||||
end, Ls),
|
||||
report_duplicated_portips(Ls),
|
||||
{ok, {{one_for_one, 10, 1}, Ls2}}
|
||||
@ -225,6 +230,20 @@ accept(ListenSocket, Module, Opts) ->
|
||||
|
||||
%% @spec (Port, Module, Opts) -> {ok, Pid} | {error, Error}
|
||||
start_listener(Port, Module, Opts) ->
|
||||
case start_listener2(Port, Module, Opts) of
|
||||
{ok, _Pid} = R -> R;
|
||||
{error, {{'EXIT', {undef, _}}, _} = Error} ->
|
||||
EStr = io_lib:format(
|
||||
"Error starting the ejabberd listener: ~p.~n"
|
||||
"It could not be loaded or is not an ejabberd listener.~n"
|
||||
"Error: ~p~n", [Module, Error]),
|
||||
{error, lists:flatten(EStr)};
|
||||
{error, Error} ->
|
||||
{error, Error}
|
||||
end.
|
||||
|
||||
%% @spec (Port, Module, Opts) -> {ok, Pid} | {error, Error}
|
||||
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()}}
|
||||
|
Loading…
Reference in New Issue
Block a user