aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2012-06-04 18:11:59 +1000
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2012-09-13 16:50:54 +1000
commit6b7d70adf6adace9406934f595fa8e50cbd6dc43 (patch)
tree12abebcec4e911742605001d877c15dfe9b655cf /src
parentAllow multiple fqdn values in configuration (EJAB-1578) (diff)
Do not close session with an item-not-found error when
receiving duplicate request with same rid as the currently active one (EJABS-1844) (thanks to Pawel Chmielowski) Conflicts: src/web/ejabberd_bosh.erl
Diffstat (limited to 'src')
-rw-r--r--src/web/ejabberd_bosh.erl26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/web/ejabberd_bosh.erl b/src/web/ejabberd_bosh.erl
index 2087e76e6..c33b058a0 100644
--- a/src/web/ejabberd_bosh.erl
+++ b/src/web/ejabberd_bosh.erl
@@ -463,20 +463,18 @@ active1(#body{attrs = Attrs} = Req, From, State) ->
{next_state, active,
State1#state{receivers = Receivers}};
RID =< State#state.prev_rid ->
- case gb_trees:lookup(RID, State#state.responses) of
- {value, PrevBody} ->
- {next_state, active,
- do_reply(State, From, PrevBody, RID)};
- none ->
- reply_stop(State,
- #body{http_reason =
- <<"Request ID is out of range">>,
- attrs =
- [{<<"type">>, <<"terminate">>},
- {<<"condition">>,
- <<"item-not-found">>}]},
- From, RID)
- end;
+ %% TODO: do we need to check 'key' here? It seems so...
+ case gb_trees:lookup(RID, State#state.responses) of
+ {value, PrevBody} ->
+ {next_state, active,
+ do_reply(State, From, PrevBody, RID)};
+ none ->
+ State1 = drop_holding_receiver(State),
+ State2 = restart_inactivity_timer(State1),
+ Receivers = gb_trees:insert(RID, {From, Req},
+ State2#state.receivers),
+ {next_state, active, State2#state{receivers = Receivers}}
+ end;
not IsValidKey ->
reply_stop(State,
#body{http_reason = <<"Session key mismatch">>,