summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2013-05-10 12:54:31 +0100
committerEmile Joubert <emile@rabbitmq.com>2013-05-10 12:54:31 +0100
commit11588542af291e50d8633bf775a9b30e8a27d9f5 (patch)
treedde8fa5770884df1b08457455f17b9b8fc05a8d4
parent4a32421a15a1af8f3af4ce22be43cf0d4b67cf69 (diff)
parentc0c9404e591a70ed87d13e3c5e8f3d10118e1c1f (diff)
downloadrabbitmq-server-11588542af291e50d8633bf775a9b30e8a27d9f5.tar.gz
Merged bug25548 int stable
-rw-r--r--src/rabbit_amqqueue_process.erl2
-rw-r--r--src/rabbit_exchange_type_headers.erl14
2 files changed, 9 insertions, 7 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 066392f8..d2f4a178 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -1356,7 +1356,7 @@ handle_cast(wake_up, State) ->
handle_info(maybe_expire, State) ->
case is_unused(State) of
true -> stop(State);
- false -> noreply(ensure_expiry_timer(State))
+ false -> noreply(State#q{expiry_timer_ref = undefined})
end;
handle_info(drop_expired, State) ->
diff --git a/src/rabbit_exchange_type_headers.erl b/src/rabbit_exchange_type_headers.erl
index cf2d3140..5b7f95fe 100644
--- a/src/rabbit_exchange_type_headers.erl
+++ b/src/rabbit_exchange_type_headers.erl
@@ -63,12 +63,14 @@ validate_binding(_X, #binding{args = Args}) ->
{binding_invalid,
"Invalid x-match field type ~p (value ~p); "
"expected longstr", [Type, Other]}};
- undefined -> {error,
- {binding_invalid, "x-match field missing", []}}
+ undefined -> ok %% [0]
end.
+%% [0] spec is vague on whether it can be omitted but in practice it's
+%% useful to allow people to do this
-parse_x_match(<<"all">>) -> all;
-parse_x_match(<<"any">>) -> any.
+parse_x_match({longstr, <<"all">>}) -> all;
+parse_x_match({longstr, <<"any">>}) -> any;
+parse_x_match(_) -> all. %% legacy; we didn't validate
%% Horrendous matching algorithm. Depends for its merge-like
%% (linear-time) behaviour on the lists:keysort
@@ -80,8 +82,8 @@ parse_x_match(<<"any">>) -> any.
%% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
%%
headers_match(Args, Data) ->
- {longstr, MK} = rabbit_misc:table_lookup(Args, <<"x-match">>),
- headers_match(Args, Data, true, false, parse_x_match(MK)).
+ MK = parse_x_match(rabbit_misc:table_lookup(Args, <<"x-match">>)),
+ headers_match(Args, Data, true, false, MK).
headers_match([], _Data, AllMatch, _AnyMatch, all) ->
AllMatch;