25
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)
end.
-spec stop_all_connections() -> ok.
stop_all_connections() ->
lists:foreach(
fun({_Id, Pid, _Type, _Module}) ->
exit(Pid, kill)
end,
supervisor:which_children(ejabberd_s2s_in_sup) ++
supervisor:which_children(ejabberd_s2s_out_sup)),
mnesia:clear_table(s2s).
supervisor:terminate_child(ejabberd_s2s_in_sup, Pid)
end, supervisor:which_children(ejabberd_s2s_in_sup)),
lists:foreach(
fun({_Id, Pid, _Type, _Module}) ->
supervisor:terminate_child(ejabberd_s2s_out_sup, Pid)
end, supervisor:which_children(ejabberd_s2s_out_sup)),
mnesia:clear_table(s2s),
ok.
%%%----------------------------------------------------------------------
%%% Update Mnesia tables