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

Stop all s2s connections via supervisor calls

This commit is contained in:
Evgeniy Khramtsov 2017-02-23 16:18:29 +03:00
parent f4081a363b
commit 0542c65a07

View File

@ -595,14 +595,18 @@ supervisor_count(Supervisor) ->
length(Result) length(Result)
end. end.
-spec stop_all_connections() -> ok.
stop_all_connections() -> stop_all_connections() ->
lists:foreach( lists:foreach(
fun({_Id, Pid, _Type, _Module}) -> fun({_Id, Pid, _Type, _Module}) ->
exit(Pid, kill) supervisor:terminate_child(ejabberd_s2s_in_sup, Pid)
end, end, supervisor:which_children(ejabberd_s2s_in_sup)),
supervisor:which_children(ejabberd_s2s_in_sup) ++ lists:foreach(
supervisor:which_children(ejabberd_s2s_out_sup)), fun({_Id, Pid, _Type, _Module}) ->
mnesia:clear_table(s2s). supervisor:terminate_child(ejabberd_s2s_out_sup, Pid)
end, supervisor:which_children(ejabberd_s2s_out_sup)),
mnesia:clear_table(s2s),
ok.
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
%%% Update Mnesia tables %%% Update Mnesia tables