From 67fe5d38a7a901335ca1ca814f09ad38afd5367a Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 5 Mar 2018 01:10:12 +0100 Subject: [PATCH] mod_push_keepalive: Preserve timeout on resumption Don't forget to carry over the original XEP-0198 resumption timeout value while resuming. --- src/mod_push_keepalive.erl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mod_push_keepalive.erl b/src/mod_push_keepalive.erl index 35932a815..750427ee1 100644 --- a/src/mod_push_keepalive.erl +++ b/src/mod_push_keepalive.erl @@ -156,9 +156,15 @@ c2s_session_resumed(State) -> -spec c2s_copy_session(c2s_state(), c2s_state()) -> c2s_state(). c2s_copy_session(State, #{push_enabled := true, push_resume_timeout := ResumeTimeout, - push_wake_on_timeout := WakeOnTimeout}) -> - State#{push_resume_timeout => ResumeTimeout, - push_wake_on_timeout => WakeOnTimeout}; + push_wake_on_timeout := WakeOnTimeout} = OldState) -> + State1 = case maps:find(push_resume_timeout_orig, OldState) of + {ok, Val} -> + State#{push_resume_timeout_orig => Val}; + error -> + State + end, + State1#{push_resume_timeout => ResumeTimeout, + push_wake_on_timeout => WakeOnTimeout}; c2s_copy_session(State, _) -> State.