summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Ionescu <vlad@lshift.net>2010-01-21 18:38:21 +0000
committerVlad Ionescu <vlad@lshift.net>2010-01-21 18:38:21 +0000
commit0f7fc0564900ecd153d3963698a2423751eb9915 (patch)
tree36c2399594befc4d48ef687edc8a7864fc9422e6
parent51bcc5e13eed1044067965d2f878fc18b8429c85 (diff)
downloadrabbitmq-server-0f7fc0564900ecd153d3963698a2423751eb9915.tar.gz
unsplitting map_exception; erlang client will be using map_exception directly
-rw-r--r--src/rabbit_binary_generator.erl25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/rabbit_binary_generator.erl b/src/rabbit_binary_generator.erl
index ba5efb26..2b99a308 100644
--- a/src/rabbit_binary_generator.erl
+++ b/src/rabbit_binary_generator.erl
@@ -46,7 +46,7 @@
build_heartbeat_frame/0]).
-export([generate_table/1, encode_properties/2]).
-export([check_empty_content_body_frame_size/0]).
--export([map_exception/2, amqp_exception/1]).
+-export([map_exception/2]).
-import(lists).
@@ -66,8 +66,6 @@
-spec(check_empty_content_body_frame_size/0 :: () -> 'ok').
-spec(map_exception/2 :: (non_neg_integer(), amqp_error()) ->
{bool(), non_neg_integer(), amqp_method()}).
--spec(amqp_exception/1 :: (amqp_error()) -> {bool(), non_neg_integer(), binary(),
- non_neg_integer(), non_neg_integer()}).
-endif.
@@ -268,10 +266,16 @@ check_empty_content_body_frame_size() ->
ComputedSize, ?EMPTY_CONTENT_BODY_FRAME_SIZE})
end.
+%% NB: this function is also used by the Erlang client
map_exception(Channel, Reason) ->
- {SuggestedClose, ReplyCode, ReplyText, ClassId, MethodId} =
- amqp_exception(Reason),
+ {SuggestedClose, ReplyCode, ReplyText, FailedMethod} =
+ lookup_amqp_exception(Reason),
ShouldClose = SuggestedClose or (Channel == 0),
+ {ClassId, MethodId} = case FailedMethod of
+ {_, _} -> FailedMethod;
+ none -> {0, 0};
+ _ -> rabbit_framing:method_id(FailedMethod)
+ end,
{CloseChannel, CloseMethod} =
case ShouldClose of
true -> {0, #'connection.close'{reply_code = ReplyCode,
@@ -285,17 +289,6 @@ map_exception(Channel, Reason) ->
end,
{ShouldClose, CloseChannel, CloseMethod}.
-%% NB: this function is also used by the Erlang client
-amqp_exception(Reason) ->
- {ShouldClose, ReplyCode, ReplyText, FailedMethod} =
- lookup_amqp_exception(Reason),
- {ClassId, MethodId} = case FailedMethod of
- {_, _} -> FailedMethod;
- none -> {0, 0};
- _ -> rabbit_framing:method_id(FailedMethod)
- end,
- {ShouldClose, ReplyCode, ReplyText, ClassId, MethodId}.
-
%% FIXME: this clause can go when we move to AMQP spec >=8.1
lookup_amqp_exception(#amqp_error{name = precondition_failed,
explanation = Expl,