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

XEP-0198: Improve handling of non-message stanzas

When an XEP-0198 session times out, always return an error for
unacknowledged IQ stanzas, and always drop presence stanzas.  That is,
the "resend_on_timeout" option no longer applies to those stanzas types,
but only to messages.
This commit is contained in:
Holger Weiss 2015-09-15 22:42:22 +02:00
parent ab857b1a5e
commit 59321ac56e

View File

@ -2920,7 +2920,13 @@ handle_unacked_stanzas(StateData)
ejabberd_router:route(To, From, Err)
end
end,
F = fun(From, To, El, Time) ->
F = fun(From, _To, #xmlel{name = <<"presence">>}, _Time) ->
?DEBUG("Dropping presence stanza from ~s",
[jlib:jid_to_string(From)]);
(From, To, #xmlel{name = <<"iq">>} = El, _Time) ->
Err = jlib:make_error_reply(El, ?ERR_SERVICE_UNAVAILABLE),
ejabberd_router:route(To, From, Err);
(From, To, El, Time) ->
%% We'll drop the stanza if it was <forwarded/> by some
%% encapsulating protocol as per XEP-0297. One such protocol is
%% XEP-0280, which says: "When a receiving server attempts to
@ -2930,7 +2936,7 @@ handle_unacked_stanzas(StateData)
%% stanza could easily lead to unexpected results as well.
case is_encapsulated_forward(El) of
true ->
?DEBUG("Dropping forwarded stanza from ~s",
?DEBUG("Dropping forwarded message stanza from ~s",
[xml:get_attr_s(<<"from">>, El#xmlel.attrs)]);
false ->
ReRoute(From, To, El, Time)