mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Fix C2S session close on server shutdown
This commit is contained in:
parent
90a5c054d4
commit
181e7a823e
@ -177,10 +177,12 @@ add_windows_nameservers() ->
|
|||||||
|
|
||||||
|
|
||||||
broadcast_c2s_shutdown() ->
|
broadcast_c2s_shutdown() ->
|
||||||
Children = supervisor:which_children(ejabberd_c2s_sup),
|
Children = ejabberd_sm:get_all_pids(),
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun({_, C2SPid, _, _}) ->
|
fun(C2SPid) when node(C2SPid) == node() ->
|
||||||
C2SPid ! system_shutdown
|
C2SPid ! system_shutdown;
|
||||||
|
(_) ->
|
||||||
|
ok
|
||||||
end, Children).
|
end, Children).
|
||||||
|
|
||||||
%%%
|
%%%
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
get_user_info/3,
|
get_user_info/3,
|
||||||
get_user_ip/3,
|
get_user_ip/3,
|
||||||
get_max_user_sessions/2,
|
get_max_user_sessions/2,
|
||||||
|
get_all_pids/0,
|
||||||
is_existing_resource/3
|
is_existing_resource/3
|
||||||
]).
|
]).
|
||||||
|
|
||||||
@ -283,13 +284,23 @@ dirty_get_my_sessions_list() ->
|
|||||||
[{'==', {node, '$1'}, node()}],
|
[{'==', {node, '$1'}, node()}],
|
||||||
['$_']}]).
|
['$_']}]).
|
||||||
|
|
||||||
|
-spec get_vh_session_list(binary()) -> [ljid()].
|
||||||
|
|
||||||
get_vh_session_list(Server) ->
|
get_vh_session_list(Server) ->
|
||||||
LServer = jlib:nameprep(Server),
|
LServer = jlib:nameprep(Server),
|
||||||
mnesia:dirty_select(session,
|
mnesia:dirty_select(session,
|
||||||
[{#session{usr = '$1', _ = '_'},
|
[{#session{usr = '$1', _ = '_'},
|
||||||
[{'==', {element, 2, '$1'}, LServer}], ['$1']}]).
|
[{'==', {element, 2, '$1'}, LServer}], ['$1']}]).
|
||||||
|
|
||||||
-spec get_vh_session_list(binary()) -> [ljid()].
|
-spec get_all_pids() -> [pid()].
|
||||||
|
|
||||||
|
get_all_pids() ->
|
||||||
|
mnesia:dirty_select(
|
||||||
|
session,
|
||||||
|
ets:fun2ms(
|
||||||
|
fun(#session{sid = {_, Pid}}) ->
|
||||||
|
Pid
|
||||||
|
end)).
|
||||||
|
|
||||||
get_vh_session_number(Server) ->
|
get_vh_session_number(Server) ->
|
||||||
LServer = jlib:nameprep(Server),
|
LServer = jlib:nameprep(Server),
|
||||||
|
Loading…
Reference in New Issue
Block a user