mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Repeated http-bind request should abort only requests with same rid
Before this change, when request with repeat rid was received any waiting request was aborted (but only after next request was delivered). With this change, only request with identical rid are aborted and this is done immediately
This commit is contained in:
parent
e8921d79ba
commit
6c94d040fa
@ -447,7 +447,6 @@ handle_sync_event({http_get, Rid, Wait, Hold}, From, StateName, StateData) ->
|
||||
((StateData#state.output == []) or (StateData#state.rid < Rid)) and
|
||||
((TNow - StateData#state.ctime) < (Wait*1000*1000)) and
|
||||
(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),
|
||||
@ -459,18 +458,6 @@ handle_sync_event({http_get, Rid, Wait, Hold}, From, StateName, StateData) ->
|
||||
out_of_order_receiver = StateData#state.rid < Rid,
|
||||
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),
|
||||
Reply = {ok, cancel},
|
||||
{reply, Reply, StateName, StateData#state{
|
||||
input = queue:new(),
|
||||
http_receiver = undefined,
|
||||
wait_timer = undefined,
|
||||
timer = Timer}};
|
||||
true ->
|
||||
cancel_timer(StateData#state.timer),
|
||||
Reply = {ok, StateData#state.output},
|
||||
@ -668,16 +655,20 @@ process_http_put(#http_put{rid = Rid, attrs = Attrs, payload = Payload,
|
||||
{reply, Reply, StateName, StateData};
|
||||
repeat ->
|
||||
?DEBUG("REPEATING ~p", [Rid]),
|
||||
Reply = case [El#hbr.out ||
|
||||
El <- StateData#state.req_list,
|
||||
El#hbr.rid == Rid] of
|
||||
[] ->
|
||||
{error, not_exists};
|
||||
[Out | _XS] ->
|
||||
{repeat, lists:reverse(Out)}
|
||||
end,
|
||||
{reply, Reply, StateName, StateData#state{input = cancel,
|
||||
last_poll = LastPoll}};
|
||||
case [El#hbr.out ||
|
||||
El <- StateData#state.req_list,
|
||||
El#hbr.rid == Rid] of
|
||||
[] ->
|
||||
{error, not_exists};
|
||||
[Out | _XS] ->
|
||||
if (Rid == StateData#state.rid) and
|
||||
(StateData#state.http_receiver /= undefined) ->
|
||||
{reply, ok, StateName, StateData};
|
||||
true ->
|
||||
Reply = {repeat, lists:reverse(Out)},
|
||||
{reply, Reply, StateName, StateData#state{last_poll = LastPoll}}
|
||||
end
|
||||
end;
|
||||
{true, Pause} ->
|
||||
SaveKey = if
|
||||
NewKey == "" ->
|
||||
|
Loading…
Reference in New Issue
Block a user