26
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

Terminate ejabberd_sm before everything else to ensure sessions closing (#3641)

This commit is contained in:
Badlop 2022-03-25 11:50:05 +01:00
parent 0f73d3f4d1
commit f19219f5a0

View File

@ -30,7 +30,8 @@
-export([start_link/0, -export([start_link/0,
%% Server %% Server
status/0, reopen_log/0, rotate_log/0, status/0, stop/0, restart/0,
reopen_log/0, rotate_log/0,
set_loglevel/1, set_loglevel/1,
stop_kindly/2, send_service_message_all_mucs/2, stop_kindly/2, send_service_message_all_mucs/2,
registered_vhosts/0, registered_vhosts/0,
@ -113,11 +114,11 @@ get_commands_spec() ->
args = [], result = {res, restuple}}, args = [], result = {res, restuple}},
#ejabberd_commands{name = stop, tags = [server], #ejabberd_commands{name = stop, tags = [server],
desc = "Stop ejabberd gracefully", desc = "Stop ejabberd gracefully",
module = init, function = stop, module = ?MODULE, function = stop,
args = [], result = {res, rescode}}, args = [], result = {res, rescode}},
#ejabberd_commands{name = restart, tags = [server], #ejabberd_commands{name = restart, tags = [server],
desc = "Restart ejabberd gracefully", desc = "Restart ejabberd gracefully",
module = init, function = restart, module = ?MODULE, function = restart,
args = [], result = {res, rescode}}, args = [], result = {res, rescode}},
#ejabberd_commands{name = reopen_log, tags = [logs], #ejabberd_commands{name = reopen_log, tags = [logs],
desc = "Reopen the log files after being renamed", desc = "Reopen the log files after being renamed",
@ -446,6 +447,16 @@ status() ->
end, end,
{Is_running, String1 ++ String2}. {Is_running, String1 ++ String2}.
stop() ->
_ = supervisor:terminate_child(ejabberd_sup, ejabberd_sm),
timer:sleep(1000),
init:stop().
restart() ->
_ = supervisor:terminate_child(ejabberd_sup, ejabberd_sm),
timer:sleep(1000),
init:restart().
reopen_log() -> reopen_log() ->
ejabberd_hooks:run(reopen_log_hook, []). ejabberd_hooks:run(reopen_log_hook, []).