diff options
| author | Matthew Sackman <matthew@rabbitmq.com> | 2011-02-11 13:14:27 +0000 |
|---|---|---|
| committer | Matthew Sackman <matthew@rabbitmq.com> | 2011-02-11 13:14:27 +0000 |
| commit | 5510373266051521648e0388877eac481669d864 (patch) | |
| tree | ed1a9edddbc0e50b5af707aab7465d9c59cbad5f /src | |
| parent | 90f31d6af6b02fd6723692df32c8e31fe71f5c65 (diff) | |
| download | rabbitmq-server-git-5510373266051521648e0388877eac481669d864.tar.gz | |
Remove boolean shouldClose from response of bin_gen:map_exception
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_binary_generator.erl | 26 | ||||
| -rw-r--r-- | src/rabbit_channel.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_reader.erl | 2 |
3 files changed, 13 insertions, 17 deletions
diff --git a/src/rabbit_binary_generator.erl b/src/rabbit_binary_generator.erl index d67c7f58e1..dc81ace6bf 100644 --- a/src/rabbit_binary_generator.erl +++ b/src/rabbit_binary_generator.erl @@ -61,8 +61,7 @@ -spec(map_exception/3 :: (rabbit_channel:channel_number(), rabbit_types:amqp_error() | any(), rabbit_types:protocol()) -> - {boolean(), - rabbit_channel:channel_number(), + {rabbit_channel:channel_number(), rabbit_framing:amqp_method_record()}). -endif. @@ -301,24 +300,21 @@ clear_encoded_content(Content = #content{}) -> map_exception(Channel, Reason, Protocol) -> {SuggestedClose, ReplyCode, ReplyText, FailedMethod} = lookup_amqp_exception(Reason, Protocol), - ShouldClose = SuggestedClose orelse (Channel == 0), {ClassId, MethodId} = case FailedMethod of {_, _} -> FailedMethod; none -> {0, 0}; _ -> Protocol:method_id(FailedMethod) end, - {CloseChannel, CloseMethod} = - case ShouldClose of - true -> {0, #'connection.close'{reply_code = ReplyCode, - reply_text = ReplyText, - class_id = ClassId, - method_id = MethodId}}; - false -> {Channel, #'channel.close'{reply_code = ReplyCode, - reply_text = ReplyText, - class_id = ClassId, - method_id = MethodId}} - end, - {ShouldClose, CloseChannel, CloseMethod}. + case SuggestedClose orelse (Channel == 0) of + true -> {0, #'connection.close'{reply_code = ReplyCode, + reply_text = ReplyText, + class_id = ClassId, + method_id = MethodId}}; + false -> {Channel, #'channel.close'{reply_code = ReplyCode, + reply_text = ReplyText, + class_id = ClassId, + method_id = MethodId}} + end. lookup_amqp_exception(#amqp_error{name = Name, explanation = Expl, diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index b2b784705f..cdf8015c76 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -359,7 +359,7 @@ send_exception(Reason, State = #ch{protocol = Protocol, channel = Channel, writer_pid = WriterPid, reader_pid = ReaderPid}) -> - {_ShouldClose, CloseChannel, CloseMethod} = + {CloseChannel, CloseMethod} = rabbit_binary_generator:map_exception(Channel, Reason, Protocol), rabbit_log:error("connection ~p, channel ~p - error:~n~p~n", [ReaderPid, Channel, Reason]), diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index 66a2fca35f..a45166afa5 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -877,7 +877,7 @@ handle_exception(State, Channel, Reason) -> send_exception(State = #v1{connection = #connection{protocol = Protocol}}, Channel, Reason) -> - {true, 0, CloseMethod} = + {0, CloseMethod} = rabbit_binary_generator:map_exception(Channel, Reason, Protocol), terminate_channels(), State1 = close_connection(State), |
