mirror of
https://github.com/processone/ejabberd.git
synced 2024-10-31 15:21:38 +01:00
Merge 1875 from trunk.
* 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: 1949
This commit is contained in:
parent
5bfdb71b4c
commit
25ef60a2c1
@ -1,5 +1,8 @@
|
|||||||
2009-03-03 Badlop <badlop@process-one.net>
|
2009-03-03 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)
|
||||||
|
|
||||||
* src/mod_privacy.erl: Privacy List: deny presence-out all + send
|
* src/mod_privacy.erl: Privacy List: deny presence-out all + send
|
||||||
presence to: presence is sent (EJAB-255)
|
presence to: presence is sent (EJAB-255)
|
||||||
* src/ejabberd_c2s.erl: Likewise
|
* src/ejabberd_c2s.erl: Likewise
|
||||||
|
@ -56,8 +56,13 @@ start_listeners() ->
|
|||||||
Ls ->
|
Ls ->
|
||||||
Ls2 = lists:map(
|
Ls2 = lists:map(
|
||||||
fun({Port, Module, Opts}) ->
|
fun({Port, Module, Opts}) ->
|
||||||
start_listener(Port, Module, Opts)
|
case start_listener(Port, Module, Opts) of
|
||||||
end, Ls),
|
{ok, _Pid} = R -> R;
|
||||||
|
{error, Error} ->
|
||||||
|
?ERROR_MSG(Error, []),
|
||||||
|
throw(Error)
|
||||||
|
end
|
||||||
|
end, Ls),
|
||||||
report_duplicated_portips(Ls),
|
report_duplicated_portips(Ls),
|
||||||
{ok, {{one_for_one, 10, 1}, Ls2}}
|
{ok, {{one_for_one, 10, 1}, Ls2}}
|
||||||
end.
|
end.
|
||||||
@ -225,6 +230,20 @@ accept(ListenSocket, Module, Opts) ->
|
|||||||
|
|
||||||
%% @spec (Port, Module, Opts) -> {ok, Pid} | {error, Error}
|
%% @spec (Port, Module, Opts) -> {ok, Pid} | {error, Error}
|
||||||
start_listener(Port, Module, Opts) ->
|
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.
|
%% It is only required to start the supervisor in some cases.
|
||||||
%% But it doesn't hurt to attempt to start it for any listener.
|
%% 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()}}
|
%% 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