]> granicus.if.org Git - ejabberd/commitdiff
Delete the ping timer only when timeout_action=kill (#2820)
authorBadlop <badlop@process-one.net>
Wed, 13 Mar 2019 10:07:13 +0000 (11:07 +0100)
committerBadlop <badlop@process-one.net>
Wed, 13 Mar 2019 10:28:31 +0000 (11:28 +0100)
src/mod_ping.erl

index 25d2b60ed6647aec81c1b987c8b990281cd48140..fd3a08909bf58fdaedfd7b1b40fd3ef71fef5a2e 100644 (file)
@@ -131,10 +131,9 @@ handle_info({iq_reply, #iq{type = error}, JID}, State) ->
 handle_info({iq_reply, #iq{}, _JID}, State) ->
     {noreply, State};
 handle_info({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
+    Timers = case State#state.timeout_action of
       kill ->
          #jid{user = User, server = Server,
               resource = Resource} =
@@ -143,8 +142,10 @@ handle_info({iq_reply, timeout, JID}, State) ->
              of
            Pid when is_pid(Pid) -> ejabberd_c2s:close(Pid, ping_timeout);
            _ -> ok
-         end;
-      _ -> ok
+         end,
+         del_timer(JID, State#state.timers);
+      _ ->
+         State#state.timers
     end,
     {noreply, State#state{timers = Timers}};
 handle_info({timeout, _TRef, {ping, JID}}, State) ->