]> granicus.if.org Git - ejabberd/commitdiff
Don't stop sending pings when receiving timeout for timeout_action=none
authorPaweł Chmielowski <pchmielowski@process-one.net>
Tue, 4 Sep 2018 07:52:41 +0000 (09:52 +0200)
committerPaweł Chmielowski <pchmielowski@process-one.net>
Tue, 4 Sep 2018 07:52:41 +0000 (09:52 +0200)
src/mod_ping.erl

index 88146b14b3b457cdda1e5e3db5eafa6f22a05c3f..e0b4a36a9cae5258558c115cf86adbc12e36fe4a 100644 (file)
@@ -123,21 +123,22 @@ handle_cast({stop_ping, JID}, State) ->
     Timers = del_timer(JID, State#state.timers),
     {noreply, State#state{timers = Timers}};
 handle_cast({iq_reply, timeout, JID}, State) ->
-    Timers = del_timer(JID, State#state.timers),
     ejabberd_hooks:run(user_ping_timeout, State#state.host,
                       [JID]),
-    case State#state.timeout_action of
-      kill ->
-         #jid{user = User, server = Server,
-              resource = Resource} =
-             JID,
-         case ejabberd_sm:get_session_pid(User, Server, Resource)
-             of
-           Pid when is_pid(Pid) -> ejabberd_c2s:close(Pid, ping_timeout);
-           _ -> ok
-         end;
-      _ -> ok
-    end,
+    Timers = case State#state.timeout_action of
+                kill ->
+                    #jid{user = User, server = Server,
+                         resource = Resource} =
+                        JID,
+                    case ejabberd_sm:get_session_pid(User, Server, Resource)
+                    of
+                        Pid when is_pid(Pid) -> ejabberd_c2s:close(Pid, ping_timeout);
+                        _ -> ok
+                    end,
+                    del_timer(JID, State#state.timers);
+                _ ->
+                    State#state.timers
+            end,
     {noreply, State#state{timers = Timers}};
 handle_cast({iq_reply, #iq{}, _JID}, State) ->
     {noreply, State};