25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Don't stop sending pings when receiving timeout for timeout_action=none

This commit is contained in:
Paweł Chmielowski 2018-09-04 09:52:41 +02:00
parent 5c931d7004
commit 57936bfa4e

View File

@ -123,21 +123,22 @@ handle_cast({stop_ping, JID}, State) ->
Timers = del_timer(JID, State#state.timers), Timers = del_timer(JID, State#state.timers),
{noreply, State#state{timers = Timers}}; {noreply, State#state{timers = Timers}};
handle_cast({iq_reply, timeout, JID}, State) -> handle_cast({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} =
JID, JID,
case ejabberd_sm:get_session_pid(User, Server, Resource) case ejabberd_sm:get_session_pid(User, Server, Resource)
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);
end, _ ->
State#state.timers
end,
{noreply, State#state{timers = Timers}}; {noreply, State#state{timers = Timers}};
handle_cast({iq_reply, #iq{}, _JID}, State) -> handle_cast({iq_reply, #iq{}, _JID}, State) ->
{noreply, State}; {noreply, State};