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

Receiving missing http-bind request shouldn't close waiting out-ouf-order request

This commit is contained in:
Paweł Chmielowski 2012-05-02 20:59:09 +02:00
parent 6719d9669b
commit e8921d79ba

View File

@ -441,8 +441,6 @@ handle_sync_event(#http_put{payload_size = PayloadSize} = Request,
%% HTTP GET: send packets to the client
handle_sync_event({http_get, Rid, Wait, Hold}, From, StateName, StateData) ->
%% setup timer
send_receiver_reply(StateData#state.http_receiver, {ok, empty}),
cancel_timer(StateData#state.wait_timer),
TNow = tnow(),
if
(Hold > 0) and
@ -451,6 +449,8 @@ handle_sync_event({http_get, Rid, Wait, Hold}, From, StateName, StateData) ->
(StateData#state.rid =< Rid) and
(StateData#state.input /= cancel) and
(StateData#state.pause == 0) ->
send_receiver_reply(StateData#state.http_receiver, {ok, empty}),
cancel_timer(StateData#state.wait_timer),
WaitTimer = erlang:start_timer(Wait * 1000, self(), []),
%% MR: Not sure we should cancel the state timer here.
cancel_timer(StateData#state.timer),
@ -460,6 +460,8 @@ handle_sync_event({http_get, Rid, Wait, Hold}, From, StateName, StateData) ->
wait_timer = WaitTimer,
timer = undefined}};
(StateData#state.input == cancel) ->
send_receiver_reply(StateData#state.http_receiver, {ok, empty}),
cancel_timer(StateData#state.wait_timer),
cancel_timer(StateData#state.timer),
Timer = set_inactivity_timer(StateData#state.pause,
StateData#state.max_inactivity),
@ -471,8 +473,6 @@ handle_sync_event({http_get, Rid, Wait, Hold}, From, StateName, StateData) ->
timer = Timer}};
true ->
cancel_timer(StateData#state.timer),
Timer = set_inactivity_timer(StateData#state.pause,
StateData#state.max_inactivity),
Reply = {ok, StateData#state.output},
%% save request
ReqList = [#hbr{rid = Rid,
@ -482,12 +482,26 @@ handle_sync_event({http_get, Rid, Wait, Hold}, From, StateName, StateData) ->
[El || El <- StateData#state.req_list,
El#hbr.rid /= Rid ]
],
if
(StateData#state.http_receiver /= undefined) and
StateData#state.out_of_order_receiver ->
{reply, Reply, StateName, StateData#state{
output = [],
timer = undefined,
req_list = ReqList,
out_of_order_receiver = false}};
true ->
send_receiver_reply(StateData#state.http_receiver, {ok, empty}),
cancel_timer(StateData#state.wait_timer),
Timer = set_inactivity_timer(StateData#state.pause,
StateData#state.max_inactivity),
{reply, Reply, StateName,
StateData#state{output = [],
http_receiver = undefined,
wait_timer = undefined,
timer = Timer,
req_list = ReqList}}
end
end;
handle_sync_event(peername, _From, StateName, StateData) ->