aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Khramtsov <xramtsov@gmail.com>2014-05-27 23:30:30 +0400
committerEvgeny Khramtsov <xramtsov@gmail.com>2014-05-27 23:30:30 +0400
commit3a27b1dd0c9f22b77020605d93901c33b74cd13c (patch)
tree932524d14768a094f48433620434b537aae71127
parentMerge pull request #225 from weiss/use-fsm-next-state (diff)
parentXEP-0198: Cosmetic change: Simplify state change (diff)
Merge pull request #226 from weiss/simplify-state-change
XEP-0198: Cosmetic change: Simplify state change
-rw-r--r--src/ejabberd_c2s.erl21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl
index c0b40725a..e6667aa8d 100644
--- a/src/ejabberd_c2s.erl
+++ b/src/ejabberd_c2s.erl
@@ -1170,8 +1170,7 @@ session_established({xmlstreamerror, _}, StateData) ->
session_established(closed, StateData)
when StateData#state.mgmt_timeout > 0,
StateData#state.mgmt_state == active ->
- log_pending_state(StateData),
- fsm_next_state(wait_for_resume, StateData#state{mgmt_state = pending});
+ fsm_next_state(wait_for_resume, StateData);
session_established(closed, StateData) ->
{stop, normal, StateData}.
@@ -1657,9 +1656,7 @@ handle_info({'DOWN', Monitor, _Type, _Object, _Info},
if StateData#state.mgmt_timeout > 0,
StateData#state.mgmt_state == active orelse
StateData#state.mgmt_state == pending ->
- log_pending_state(StateData),
- fsm_next_state(wait_for_resume,
- StateData#state{mgmt_state = pending});
+ fsm_next_state(wait_for_resume, StateData);
true ->
{stop, normal, StateData}
end;
@@ -2435,10 +2432,12 @@ fsm_next_state_gc(StateName, PackedStateData) ->
fsm_next_state(session_established, StateData) ->
{next_state, session_established, StateData,
?C2S_HIBERNATE_TIMEOUT};
-fsm_next_state(wait_for_resume, #state{mgmt_pending_since = undefined} =
- StateData) ->
+fsm_next_state(wait_for_resume, StateData)
+ when StateData#state.mgmt_state /= pending ->
+ ?INFO_MSG("Waiting for resumption of stream for ~s",
+ [jlib:jid_to_string(StateData#state.jid)]),
{next_state, wait_for_resume,
- StateData#state{mgmt_pending_since = os:timestamp()},
+ StateData#state{mgmt_state = pending, mgmt_pending_since = os:timestamp()},
StateData#state.mgmt_timeout};
fsm_next_state(wait_for_resume, StateData) ->
Diff = timer:now_diff(os:timestamp(), StateData#state.mgmt_pending_since),
@@ -2805,12 +2804,6 @@ limit_queue_length(#state{jid = JID,
StateData
end.
-log_pending_state(StateData) when StateData#state.mgmt_state /= pending ->
- ?INFO_MSG("Waiting for resumption of stream for ~s",
- [jlib:jid_to_string(StateData#state.jid)]);
-log_pending_state(_StateData) ->
- ok.
-
handle_unacked_stanzas(StateData, F)
when StateData#state.mgmt_state == active;
StateData#state.mgmt_state == pending ->