24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-08 21:43:07 +02:00

Don't put duplicate polling attribute in bosh payload

This fixes issue #2790
This commit is contained in:
Paweł Chmielowski 2019-05-14 17:32:12 +02:00
parent 1452023c93
commit 122cb4b959

View File

@ -324,10 +324,10 @@ wait_for_session(#body{attrs = Attrs} = Req, From,
NewKey = get_attr(newkey, Attrs), NewKey = get_attr(newkey, Attrs),
Type = get_attr(type, Attrs), Type = get_attr(type, Attrs),
Requests = Hold + 1, Requests = Hold + 1,
{PollTime, Polling} = if Wait == 0, Hold == 0 -> PollTime = if
{erlang:timestamp(), [{polling, ?DEFAULT_POLLING}]}; Wait == 0, Hold == 0 -> erlang:timestamp();
true -> {undefined, []} true -> undefined
end, end,
MaxPause = gen_mod:get_module_opt(State#state.host, MaxPause = gen_mod:get_module_opt(State#state.host,
mod_bosh, max_pause), mod_bosh, max_pause),
Resp = #body{attrs = Resp = #body{attrs =
@ -337,8 +337,7 @@ wait_for_session(#body{attrs = Attrs} = Req, From,
{hold, Hold}, {'xmpp:restartlogic', true}, {hold, Hold}, {'xmpp:restartlogic', true},
{requests, Requests}, {secure, true}, {requests, Requests}, {secure, true},
{maxpause, MaxPause}, {'xmlns:xmpp', ?NS_BOSH}, {maxpause, MaxPause}, {'xmlns:xmpp', ?NS_BOSH},
{'xmlns:stream', ?NS_STREAM}, {from, State#state.host} {'xmlns:stream', ?NS_STREAM}, {from, State#state.host}]},
| Polling]},
{ShaperState, _} = {ShaperState, _} =
ejabberd_shaper:update(State#state.shaper_state, Req#body.size), ejabberd_shaper:update(State#state.shaper_state, Req#body.size),
State1 = State#state{wait_timeout = Wait, State1 = State#state{wait_timeout = Wait,