Delete ping timer if resource is gone after the ping has been sent

This commit is contained in:
Jérôme Sautret 2022-04-28 14:54:41 +02:00
parent b34291762a
commit 69a5a22810
1 changed files with 8 additions and 0 deletions

View File

@ -132,6 +132,14 @@ handle_cast(Msg, State) ->
?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
handle_info({iq_reply, #iq{type = error} = IQ, JID}, State) ->
Timers = case xmpp:get_error(IQ) of
#stanza_error{type=cancel, reason='service-unavailable'} ->
del_timer(JID, State#state.timers);
_ ->
State#state.timers
end,
{noreply, State#state{timers = Timers}};
handle_info({iq_reply, #iq{}, _JID}, State) ->
{noreply, State};
handle_info({iq_reply, timeout, JID}, State) ->