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 | 20568d5a3bb331a6bef29bb291f1f5ec617d515a (patch) | |
tree | 1415ffc4f12b085afb9e06eb2d872ecc7e2440c2 | |
parent | 543afa15719001aef805e5b1d75db587dffd4dca (diff) | |
download | rabbitmq-server-20568d5a3bb331a6bef29bb291f1f5ec617d515a.tar.gz |
Only look for AMQP errors in exits.
-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 751d4122..ea7de555 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, |