mirror of
https://github.com/processone/ejabberd.git
synced 2024-09-27 14:30:55 +02:00
Remove processing of {wait, _} result in gen_mod
This is no longer needed
This commit is contained in:
parent
a4e19b7108
commit
e1eedd587d
@ -277,40 +277,16 @@ stop_module(Host, Module) ->
|
|||||||
-spec stop_module_keep_config(binary(), atom()) -> error | ok.
|
-spec stop_module_keep_config(binary(), atom()) -> error | ok.
|
||||||
stop_module_keep_config(Host, Module) ->
|
stop_module_keep_config(Host, Module) ->
|
||||||
?DEBUG("Stopping ~s at ~s", [Module, Host]),
|
?DEBUG("Stopping ~s at ~s", [Module, Host]),
|
||||||
case catch Module:stop(Host) of
|
try Module:stop(Host) of
|
||||||
{'EXIT', Reason} -> ?ERROR_MSG("~p", [Reason]), error;
|
_ ->
|
||||||
{wait, ProcList} when is_list(ProcList) ->
|
ets:delete(ejabberd_modules, {Module, Host}),
|
||||||
lists:foreach(fun wait_for_process/1, ProcList),
|
|
||||||
ets:delete(ejabberd_modules, {Module, Host}),
|
|
||||||
ok;
|
|
||||||
{wait, Process} ->
|
|
||||||
wait_for_process(Process),
|
|
||||||
ets:delete(ejabberd_modules, {Module, Host}),
|
|
||||||
ok;
|
|
||||||
_ -> ets:delete(ejabberd_modules, {Module, Host}), ok
|
|
||||||
end.
|
|
||||||
|
|
||||||
wait_for_process(Process) ->
|
|
||||||
try erlang:monitor(process, Process) of
|
|
||||||
MonitorReference ->
|
|
||||||
wait_for_stop(Process, MonitorReference)
|
|
||||||
catch
|
|
||||||
_:_ ->
|
|
||||||
ok
|
ok
|
||||||
end.
|
catch ?EX_RULE(Class, Reason, St) ->
|
||||||
|
StackTrace = ?EX_STACK(St),
|
||||||
wait_for_stop(Process, MonitorReference) ->
|
?ERROR_MSG("Failed to stop module ~s at ~s:~n** ~s",
|
||||||
receive
|
[Module, Host,
|
||||||
{'DOWN', MonitorReference, _Type, _Object, _Info} -> ok
|
misc:format_exception(2, Class, Reason, StackTrace)]),
|
||||||
after 5000 ->
|
error
|
||||||
catch exit(whereis(Process), kill),
|
|
||||||
wait_for_stop1(MonitorReference)
|
|
||||||
end.
|
|
||||||
|
|
||||||
wait_for_stop1(MonitorReference) ->
|
|
||||||
receive
|
|
||||||
{'DOWN', MonitorReference, _Type, _Object, _Info} -> ok
|
|
||||||
after 5000 -> ok
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec get_opt(atom(), opts()) -> any().
|
-spec get_opt(atom(), opts()) -> any().
|
||||||
|
Loading…
Reference in New Issue
Block a user