mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
When ejabberd stops, send stream close to clients (thanks to Alexey Shchepin)(EJAB-1112)
SVN Revision: 2859
This commit is contained in:
parent
38dfef923c
commit
8c0cc95a55
@ -77,6 +77,8 @@ start(_, _) ->
|
|||||||
prep_stop(State) ->
|
prep_stop(State) ->
|
||||||
stop_modules(),
|
stop_modules(),
|
||||||
ejabberd_admin:stop(),
|
ejabberd_admin:stop(),
|
||||||
|
broadcast_c2s_shutdown(),
|
||||||
|
timer:sleep(5000),
|
||||||
State.
|
State.
|
||||||
|
|
||||||
%% All the processes were killed when this function is called
|
%% All the processes were killed when this function is called
|
||||||
@ -186,6 +188,13 @@ add_windows_nameservers() ->
|
|||||||
lists:foreach(fun(IPT) -> inet_db:add_ns(IPT) end, IPTs).
|
lists:foreach(fun(IPT) -> inet_db:add_ns(IPT) end, IPTs).
|
||||||
|
|
||||||
|
|
||||||
|
broadcast_c2s_shutdown() ->
|
||||||
|
Children = supervisor:which_children(ejabberd_c2s_sup),
|
||||||
|
lists:foreach(
|
||||||
|
fun({_, C2SPid, _, _}) ->
|
||||||
|
C2SPid ! system_shutdown
|
||||||
|
end, Children).
|
||||||
|
|
||||||
%%%
|
%%%
|
||||||
%%% PID file
|
%%% PID file
|
||||||
%%%
|
%%%
|
||||||
|
@ -1258,6 +1258,19 @@ handle_info({route, From, To, Packet}, StateName, StateData) ->
|
|||||||
handle_info({'DOWN', Monitor, _Type, _Object, _Info}, _StateName, StateData)
|
handle_info({'DOWN', Monitor, _Type, _Object, _Info}, _StateName, StateData)
|
||||||
when Monitor == StateData#state.socket_monitor ->
|
when Monitor == StateData#state.socket_monitor ->
|
||||||
{stop, normal, StateData};
|
{stop, normal, StateData};
|
||||||
|
handle_info(system_shutdown, StateName, StateData) ->
|
||||||
|
case StateName of
|
||||||
|
wait_for_stream ->
|
||||||
|
send_header(StateData#state.streamid, ?MYNAME, "1.0", ""),
|
||||||
|
send_element(StateData, exmpp_stream:error('system-shutdown')),
|
||||||
|
send_text(StateData, ?STREAM_TRAILER),
|
||||||
|
ok;
|
||||||
|
_ ->
|
||||||
|
send_element(StateData, exmpp_stream:error('system-shutdown')),
|
||||||
|
send_text(StateData, ?STREAM_TRAILER),
|
||||||
|
ok
|
||||||
|
end,
|
||||||
|
{stop, normal, StateData};
|
||||||
handle_info(Info, StateName, StateData) ->
|
handle_info(Info, StateName, StateData) ->
|
||||||
?ERROR_MSG("Unexpected info: ~p", [Info]),
|
?ERROR_MSG("Unexpected info: ~p", [Info]),
|
||||||
fsm_next_state(StateName, StateData).
|
fsm_next_state(StateName, StateData).
|
||||||
|
Loading…
Reference in New Issue
Block a user