25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

Wait for more data than just <stream:stream> before sending in bosh

This fixes issue #2545
This commit is contained in:
Paweł Chmielowski 2018-07-26 18:55:30 +02:00
parent ca022b6d1f
commit 1af2cf37ea

View File

@ -365,15 +365,22 @@ wait_for_session(#body{attrs = Attrs} = Req, From,
{State3, RespEls} = get_response_els(State2),
State4 = stop_inactivity_timer(State3),
case RespEls of
[] ->
State5 = restart_wait_timer(State4),
Receivers = gb_trees:insert(RID, {From, Resp},
State5#state.receivers),
{next_state, active,
State5#state{receivers = Receivers}};
_ ->
reply_next_state(State4, Resp#body{els = RespEls}, RID,
From)
[{xmlstreamstart, _, _} = El1] ->
OutBuf = buf_in([El1], State4#state.el_obuf),
State5 = restart_wait_timer(State4),
Receivers = gb_trees:insert(RID, {From, Resp},
State5#state.receivers),
{next_state, active,
State5#state{receivers = Receivers, el_obuf = OutBuf}};
[] ->
State5 = restart_wait_timer(State4),
Receivers = gb_trees:insert(RID, {From, Resp},
State5#state.receivers),
{next_state, active,
State5#state{receivers = Receivers}};
_ ->
reply_next_state(State4, Resp#body{els = RespEls}, RID,
From)
end;
wait_for_session(_Event, _From, State) ->
?ERROR_MSG("unexpected sync event in 'wait_for_session': ~p",