]> granicus.if.org Git - ejabberd/commitdiff
Stop all s2s connections via supervisor calls
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Thu, 23 Feb 2017 13:18:29 +0000 (16:18 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Thu, 23 Feb 2017 13:18:29 +0000 (16:18 +0300)
src/ejabberd_s2s.erl

index 76fb522f0a78b0dd173767958a4a6ba6c3ce9c9f..99ee6de9f914772ab28c3841ce27131b79c298ab 100644 (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