]> granicus.if.org Git - ejabberd/commitdiff
Correctly report resume timeout
authorEvgeny Khramtsov <ekhramtsov@process-one.net>
Tue, 30 Jul 2019 09:50:31 +0000 (12:50 +0300)
committerEvgeny Khramtsov <ekhramtsov@process-one.net>
Tue, 30 Jul 2019 09:50:31 +0000 (12:50 +0300)
src/mod_push_keepalive.erl
src/mod_stream_mgmt.erl

index 3f55eaa92939de5c27d8ddfeaed89379714561f5..c4e8f03d29adbae6485b8d35b5e5972e0cceeb79 100644 (file)
@@ -201,13 +201,13 @@ maybe_adjust_resume_timeout(#{push_resume_timeout := undefined} = State) ->
     State;
 maybe_adjust_resume_timeout(#{push_resume_timeout := Timeout} = State) ->
     OrigTimeout = mod_stream_mgmt:get_resume_timeout(State),
-    ?DEBUG("Adjusting resume timeout to ~B seconds", [Timeout]),
+    ?DEBUG("Adjusting resume timeout to ~B seconds", [Timeout div 1000]),
     State1 = mod_stream_mgmt:set_resume_timeout(State, Timeout),
     State1#{push_resume_timeout_orig => OrigTimeout}.
 
 -spec maybe_restore_resume_timeout(c2s_state()) -> c2s_state().
 maybe_restore_resume_timeout(#{push_resume_timeout_orig := Timeout} = State) ->
-    ?DEBUG("Restoring resume timeout to ~B seconds", [Timeout]),
+    ?DEBUG("Restoring resume timeout to ~B seconds", [Timeout div 1000]),
     State1 = mod_stream_mgmt:set_resume_timeout(State, Timeout),
     maps:remove(push_resume_timeout_orig, State1);
 maybe_restore_resume_timeout(State) ->
@@ -218,7 +218,7 @@ maybe_start_wakeup_timer(#{push_wake_on_timeout := true,
                           push_resume_timeout := ResumeTimeout} = State)
   when is_integer(ResumeTimeout), ResumeTimeout > ?PUSH_BEFORE_TIMEOUT_PERIOD ->
     WakeTimeout = ResumeTimeout - ?PUSH_BEFORE_TIMEOUT_PERIOD,
-    ?DEBUG("Scheduling wake-up timer to fire in ~B seconds", [WakeTimeout]),
+    ?DEBUG("Scheduling wake-up timer to fire in ~B seconds", [WakeTimeout div 1000]),
     erlang:start_timer(WakeTimeout, self(), push_keepalive),
     State;
 maybe_start_wakeup_timer(State) ->
index 829c07e1a2fea5ebb79a83f71b9eab520d23342c..e086b29cc59c5f8cc4271a3f2ed451dff46ba4a0 100644 (file)
@@ -381,7 +381,7 @@ handle_enable(#{mgmt_timeout := DefaultTimeout,
                  #sm_enabled{xmlns = Xmlns,
                              id = make_resume_id(State),
                              resume = true,
-                             max = Timeout};
+                             max = Timeout div 1000};
             true ->
                  ?DEBUG("Stream management without resumption enabled for ~s",
                         [jid:encode(JID)]),
@@ -444,7 +444,8 @@ transition_to_pending(#{mgmt_state := active, mod := Mod,
 transition_to_pending(#{mgmt_state := active, jid := JID,
                        lserver := LServer, mgmt_timeout := Timeout} = State) ->
     State1 = cancel_ack_timer(State),
-    ?INFO_MSG("Waiting for resumption of stream for ~s", [jid:encode(JID)]),
+    ?INFO_MSG("Waiting ~B seconds for resumption of stream for ~s",
+             [Timeout div 1000, jid:encode(JID)]),
     TRef = erlang:start_timer(Timeout, self(), pending_timeout),
     State2 = State1#{mgmt_state => pending, mgmt_pending_timer => TRef},
     ejabberd_hooks:run_fold(c2s_session_pending, LServer, State2, []);