24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-14 22:00:16 +02:00

mod_http_upload: Log error if 'put_url' is reused

Log a proper [error] message if a single 'put_url' is used for multiple
virtual hosts.
This commit is contained in:
Holger Weiss 2018-09-17 21:46:37 +02:00
parent d5c1174385
commit d2cdfa66f9

View File

@ -122,7 +122,7 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% gen_mod/supervisor callbacks. %% gen_mod/supervisor callbacks.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
-spec start(binary(), gen_mod:opts()) -> {ok, pid()}. -spec start(binary(), gen_mod:opts()) -> {ok, pid()} | {error, already_started}.
start(ServerHost, Opts) -> start(ServerHost, Opts) ->
case gen_mod:get_opt(rm_on_unregister, Opts) of case gen_mod:get_opt(rm_on_unregister, Opts) of
true -> true ->
@ -132,7 +132,14 @@ start(ServerHost, Opts) ->
ok ok
end, end,
Proc = get_proc_name(ServerHost, ?MODULE), Proc = get_proc_name(ServerHost, ?MODULE),
gen_mod:start_child(?MODULE, ServerHost, Opts, Proc). case whereis(Proc) of
undefined ->
gen_mod:start_child(?MODULE, ServerHost, Opts, Proc);
_Pid ->
?ERROR_MSG("Multiple virtual hosts can't use a single 'put_url' "
"without the @HOST@ keyword", []),
{error, already_started}
end.
-spec stop(binary()) -> ok | {error, any()}. -spec stop(binary()) -> ok | {error, any()}.
stop(ServerHost) -> stop(ServerHost) ->