summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2013-11-26 18:31:32 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2013-11-26 18:31:32 +0000
commita00a34b1e37f9f1796413fe5e9fbb3fc353cade5 (patch)
tree47f3fa78d2ccdeaa828fa71331faf8c4e1543e8d /src
parentc4cd76dcd462b64458fc25889d3a7a0b554d3d22 (diff)
downloadrabbitmq-server-git-a00a34b1e37f9f1796413fe5e9fbb3fc353cade5.tar.gz
various fixes and refactors
- replace two 'case's with one - the opposite of 'lower' is not 'greater' but 'higher' - eliminate unnecessary intermediate var - use rabbit_misc:protocol_error/4 instead of rabbit_misc:protocol_error/1 + rabbit_misc:amqp_error/4 - don't use ~p unnecessarily
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_reader.erl23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index 04c2a159e6..d0ab1df329 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -926,21 +926,14 @@ validate_negotiated_integer_value(Field, ClientValue, ServerValue, Min) ->
ok
end.
-fail_negotiation(Field, ClientValue,
- ServerValue, MinOrMax) ->
- S1 = case MinOrMax of
- min -> lower;
- max -> greater
- end,
- S2 = case MinOrMax of
- min -> minimum;
- max -> maximum
- end,
- AmqpError = rabbit_misc:amqp_error(
- not_allowed,
- "negotiated ~p = ~w is ~p than the ~p allowed value (~w)",
- [Field, ClientValue, S1, S2, ServerValue], none),
- rabbit_misc:protocol_error(AmqpError).
+fail_negotiation(Field, ClientValue, ServerValue, MinOrMax) ->
+ {S1,S2} = case MinOrMax of
+ min -> {lower, minimum};
+ max -> {higher, maximum}
+ end,
+ rabbit_misc:protocol_error(
+ not_allowed, "negotiated ~p = ~w is ~p than the ~p allowed value (~w)",
+ [Field, ClientValue, S1, S2, ServerValue], 'connection.tune').
server_frame_max() ->
{ok, FrameMax} = application:get_env(rabbit, frame_max),