summaryrefslogtreecommitdiff
path: root/src/rabbit_reader.erl
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2011-02-10 17:06:42 +0000
committerMatthew Sackman <matthew@rabbitmq.com>2011-02-10 17:06:42 +0000
commit4a31066692b2254b310c4befb461363f0fb6c686 (patch)
tree24df9e04f0dcfe7771e775cbdbacc16acd602de5 /src/rabbit_reader.erl
parentc6725f21f584b3e51dabb8cc8fa213d5e07ad261 (diff)
downloadrabbitmq-server-4a31066692b2254b310c4befb461363f0fb6c686.tar.gz
Always log the error from the channel; can now guarantee exceptions that turn up in the reader are hard exceptions
Diffstat (limited to 'src/rabbit_reader.erl')
-rw-r--r--src/rabbit_reader.erl23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index 0cb4b5bf..951cf439 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -976,29 +976,20 @@ process_channel_frame(Frame, ErrPid, Channel, ChPid, AState) ->
AState
end.
-log_channel_error(ConnectionState, Channel, Reason) ->
- rabbit_log:error("connection ~p (~p), channel ~p - error:~n~p~n",
- [self(), ConnectionState, Channel, Reason]).
-
-handle_exception(State = #v1{connection_state = closed}, Channel, Reason) ->
- log_channel_error(closed, Channel, Reason),
+handle_exception(State = #v1{connection_state = closed}, _Channel, _Reason) ->
State;
-handle_exception(State = #v1{connection_state = CS}, Channel, Reason) ->
- log_channel_error(CS, Channel, Reason),
+handle_exception(State, Channel, Reason) ->
send_exception(State, Channel, Reason).
send_exception(State = #v1{connection = #connection{protocol = Protocol}},
Channel, Reason) ->
- {ShouldClose, CloseChannel, CloseMethod} =
+ {true, 0, CloseMethod} =
rabbit_binary_generator:map_exception(Channel, Reason, Protocol),
- NewState = case ShouldClose of
- true -> terminate_channels(),
- close_connection(State);
- false -> close_channel(Channel, State)
- end,
+ terminate_channels(),
+ State1 = close_connection(State),
ok = rabbit_writer:internal_send_command(
- NewState#v1.sock, CloseChannel, CloseMethod, Protocol),
- NewState.
+ State1#v1.sock, 0, CloseMethod, Protocol),
+ State1.
internal_emit_stats(State = #v1{stats_timer = StatsTimer}) ->
rabbit_event:notify(connection_stats, infos(?STATISTICS_KEYS, State)),