aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJérôme Sautret <jerome@sautret.org>2022-04-28 14:54:41 +0200
committerJérôme Sautret <jerome@sautret.org>2022-04-28 14:54:41 +0200
commit69a5a22810ffda701507dc88cfa03af119c3b471 (patch)
tree20706cc38dd6dc47498d8c84593b03aa4b945c43 /src
parentRemove dialyzer warning (diff)
Delete ping timer if resource is gone after the ping has been sent
Diffstat (limited to 'src')
-rw-r--r--src/mod_ping.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mod_ping.erl b/src/mod_ping.erl
index da6733617..2ee5133fa 100644
--- a/src/mod_ping.erl
+++ b/src/mod_ping.erl
@@ -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) ->