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

XEP-0198: Cancel timer when waiting for resumption

If an ACK timer is active while going into the 'wait_for_resume' state,
cancel that timer.
This commit is contained in:
Holger Weiss 2016-09-09 00:21:36 +02:00
parent 8fd888eb2b
commit d222fed228

View File

@ -1772,7 +1772,7 @@ handle_info(close, StateName, StateData) ->
?DEBUG("Timeout waiting for stream management acknowledgement of ~s",
[jid:to_string(StateData#state.jid)]),
close(self()),
fsm_next_state(StateName, StateData);
fsm_next_state(StateName, StateData#state{mgmt_ack_timer = undefined});
handle_info({_Ref, {resume, OldStateData}}, StateName, StateData) ->
%% This happens if the resume_session/1 request timed out; the new session
%% now receives the late response.
@ -2495,6 +2495,12 @@ fsm_next_state(wait_for_resume, #state{mgmt_timeout = 0} = StateData) ->
{stop, normal, StateData};
fsm_next_state(wait_for_resume, #state{mgmt_pending_since = undefined} =
StateData) ->
case StateData of
#state{mgmt_ack_timer = undefined} ->
ok;
#state{mgmt_ack_timer = Timer} ->
erlang:cancel_timer(Timer)
end,
?INFO_MSG("Waiting for resumption of stream for ~s",
[jid:to_string(StateData#state.jid)]),
{next_state, wait_for_resume,