summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@lshift.net>2009-01-04 11:26:57 +0000
committerMatthias Radestock <matthias@lshift.net>2009-01-04 11:26:57 +0000
commit024f3ea569c94a2b967644d5d51a0f2acf99d4d5 (patch)
tree19dd0991c86990409ad86edba2db41127191c2d9 /src
parent41360d7851b52b5fc51765792408afbe3467ef50 (diff)
parent69957f6f24f98fb0ad264599b47ca6c71ebb38b8 (diff)
downloadrabbitmq-server-git-024f3ea569c94a2b967644d5d51a0f2acf99d4d5.tar.gz
merge default into v1_5_1
All the changes made on 'default' so far should go into v1_5_1. Which is lucky since we don't have to cherry pick.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_channel.erl13
-rw-r--r--src/rabbit_exchange.erl20
2 files changed, 25 insertions, 8 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 5d7fde90ef..ca2782c77d 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -111,20 +111,23 @@ init(ProxyPid, [ReaderPid, WriterPid, Username, VHost]) ->
consumer_mapping = dict:new()}.
handle_message({method, Method, Content}, State) ->
- case (catch handle_method(Method, Content, State)) of
+ try handle_method(Method, Content, State) of
{reply, Reply, NewState} ->
ok = rabbit_writer:send_command(NewState#ch.writer_pid, Reply),
NewState;
{noreply, NewState} ->
NewState;
stop ->
- exit(normal);
- {'EXIT', {amqp, Error, Explanation, none}} ->
+ exit(normal)
+ catch
+ exit:{amqp, Error, Explanation, none} ->
terminate({amqp, Error, Explanation,
rabbit_misc:method_record_type(Method)},
State);
- {'EXIT', Reason} ->
- terminate(Reason, State)
+ exit:normal ->
+ terminate(normal, State);
+ _:Reason ->
+ terminate({Reason, erlang:get_stacktrace()}, State)
end;
handle_message(terminate, State) ->
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl
index 299747d141..925c335cee 100644
--- a/src/rabbit_exchange.erl
+++ b/src/rabbit_exchange.erl
@@ -238,7 +238,19 @@ route(#exchange{name = Name, type = topic}, RoutingKey) ->
%% TODO: This causes a full scan for each entry
%% with the same exchange (see bug 19336)
topic_matches(BindingKey, RoutingKey)]),
- lookup_qpids(mnesia:async_dirty(fun qlc:e/1, [Query]));
+ lookup_qpids(
+ try
+ mnesia:async_dirty(fun qlc:e/1, [Query])
+ catch exit:{aborted, {badarg, _}} ->
+ %% work around OTP-7025, which was fixed in R12B-1, by
+ %% falling back on a less efficient method
+ [QName || #route{binding = #binding{queue_name = QName,
+ key = BindingKey}} <-
+ mnesia:dirty_match_object(
+ #route{binding = #binding{exchange_name = Name,
+ _ = '_'}}),
+ topic_matches(BindingKey, RoutingKey)]
+ end);
route(X = #exchange{type = fanout}, _) ->
route_internal(X, '_');
@@ -256,8 +268,10 @@ route_internal(#exchange{name = Name}, RoutingKey) ->
lookup_qpids(Queues) ->
sets:fold(
fun(Key, Acc) ->
- [#amqqueue{pid = QPid}] = mnesia:dirty_read({amqqueue, Key}),
- [QPid | Acc]
+ case mnesia:dirty_read({amqqueue, Key}) of
+ [#amqqueue{pid = QPid}] -> [QPid | Acc];
+ [] -> Acc
+ end
end, [], sets:from_list(Queues)).
%% TODO: Should all of the route and binding management not be