1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-03 17:59:31 +02:00

Delete the ping timer only when timeout_action=kill (#2820)

This commit is contained in:
Badlop 2019-03-13 11:07:13 +01:00
parent 333b010d54
commit 629e568294

View file

@ -131,10 +131,9 @@ handle_info({iq_reply, #iq{type = error}, JID}, State) ->
handle_info({iq_reply, #iq{}, _JID}, State) -> handle_info({iq_reply, #iq{}, _JID}, State) ->
{noreply, State}; {noreply, State};
handle_info({iq_reply, timeout, JID}, State) -> handle_info({iq_reply, timeout, JID}, State) ->
Timers = del_timer(JID, State#state.timers),
ejabberd_hooks:run(user_ping_timeout, State#state.host, ejabberd_hooks:run(user_ping_timeout, State#state.host,
[JID]), [JID]),
case State#state.timeout_action of Timers = case State#state.timeout_action of
kill -> kill ->
#jid{user = User, server = Server, #jid{user = User, server = Server,
resource = Resource} = resource = Resource} =
@ -143,8 +142,10 @@ handle_info({iq_reply, timeout, JID}, State) ->
of of
Pid when is_pid(Pid) -> ejabberd_c2s:close(Pid, ping_timeout); Pid when is_pid(Pid) -> ejabberd_c2s:close(Pid, ping_timeout);
_ -> ok _ -> ok
end; end,
_ -> ok del_timer(JID, State#state.timers);
_ ->
State#state.timers
end, end,
{noreply, State#state{timers = Timers}}; {noreply, State#state{timers = Timers}};
handle_info({timeout, _TRef, {ping, JID}}, State) -> handle_info({timeout, _TRef, {ping, JID}}, State) ->