diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2010-12-02 15:07:01 +0000 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2010-12-02 15:07:01 +0000 |
| commit | 49e874ef21fb804f8a018735d80de835322505e6 (patch) | |
| tree | 1415ffc4f12b085afb9e06eb2d872ecc7e2440c2 /src | |
| parent | 0a467a1836009ded735413eea8e49bc63bcafa00 (diff) | |
| download | rabbitmq-server-git-49e874ef21fb804f8a018735d80de835322505e6.tar.gz | |
Only look for AMQP errors in exits.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_reader.erl | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index 751d412200..ea7de55579 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -710,25 +710,32 @@ ensure_stats_timer(State) -> handle_method0(MethodName, FieldsBin, State = #v1{connection = #connection{protocol = Protocol}}) -> + HandleException = + fun(R) -> + case ?IS_RUNNING(State) of + true -> send_exception(State, 0, R); + %% We don't trust the client at this point - force + %% them to wait for a bit so they can't DOS us with + %% repeated failed logins etc. + false -> timer:sleep(?SILENT_CLOSE_DELAY * 1000), + throw({channel0_error, State#v1.connection_state, R}) + end + end, try handle_method0(Protocol:decode_method_fields(MethodName, FieldsBin), State) - catch Type:Reason -> + catch exit:Reason -> CompleteReason = case Reason of #amqp_error{method = none} -> Reason#amqp_error{method = MethodName}; - OtherReason -> {Type, OtherReason, + OtherReason -> {exit, OtherReason, erlang:get_stacktrace()} end, - case ?IS_RUNNING(State) of - true -> send_exception(State, 0, CompleteReason); - %% We don't trust the client at this point - force - %% them to wait for a bit so they can't DOS us with - %% repeated failed logins etc. - false -> timer:sleep(?SILENT_CLOSE_DELAY * 1000), - throw({channel0_error, State#v1.connection_state, - CompleteReason}) - end + HandleException(CompleteReason); + error:Reason -> + HandleException({error, Reason, erlang:get_stacktrace()}); + throw:Reason -> + HandleException({throw, Reason, erlang:get_stacktrace()}) end. handle_method0(#'connection.start_ok'{mechanism = Mechanism, |
