diff options
author | John DeTreville <jdetreville@vmware.com> | 2010-12-08 17:13:14 -0800 |
---|---|---|
committer | John DeTreville <jdetreville@vmware.com> | 2010-12-08 17:13:14 -0800 |
commit | 63f41f09a6d700d4e1714a96a074fb9f71091deb (patch) | |
tree | 9e5a805a91502a344fa8d13f60cd1e648dc9e13a | |
parent | 79a6cc8f2b0adc5956fe4ff4df62aff6f81e1451 (diff) | |
download | rabbitmq-server-63f41f09a6d700d4e1714a96a074fb9f71091deb.tar.gz |
Clients can now override frame_max in RabbitMQ server.
-rw-r--r-- | src/rabbit_reader.erl | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index 4dd150a2..b6df9c98 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -50,7 +50,6 @@ -define(CLOSING_TIMEOUT, 1). -define(CHANNEL_TERMINATION_TIMEOUT, 3). -define(SILENT_CLOSE_DELAY, 3). --define(FRAME_MAX, 131072). %% set to zero once QPid fix their negotiation %--------------------------------------------------------------------------- @@ -739,7 +738,7 @@ handle_method0(#'connection.start_ok'{mechanism = Mechanism, sock = Sock}) -> User = rabbit_access_control:check_login(Mechanism, Response), Tune = #'connection.tune'{channel_max = 0, - frame_max = ?FRAME_MAX, + frame_max = my_frame_max(), heartbeat = 0}, ok = send_on_channel0(Sock, Tune, Protocol), State#v1{connection_state = tuning, @@ -752,14 +751,15 @@ handle_method0(#'connection.tune_ok'{frame_max = FrameMax, connection = Connection, sock = Sock, start_heartbeat_fun = SHF}) -> - if (FrameMax /= 0) and (FrameMax < ?FRAME_MIN_SIZE) -> + MyFrameMax = my_frame_max(), + if FrameMax /= 0 andalso FrameMax < ?FRAME_MIN_SIZE -> rabbit_misc:protocol_error( not_allowed, "frame_max=~w < ~w min size", [FrameMax, ?FRAME_MIN_SIZE]); - (?FRAME_MAX /= 0) and (FrameMax > ?FRAME_MAX) -> + MyFrameMax /= 0 andalso FrameMax > MyFrameMax -> rabbit_misc:protocol_error( not_allowed, "frame_max=~w > ~w max size", - [FrameMax, ?FRAME_MAX]); + [FrameMax, MyFrameMax]); true -> SendFun = fun() -> @@ -824,6 +824,14 @@ handle_method0(_Method, #v1{connection_state = S}) -> rabbit_misc:protocol_error( channel_error, "unexpected method in connection state ~w", [S]). +%% Compute frame_max for this instance. Could use 0, but breaks QPid Java +%% client. Default is 131072, but user can override in rabbitmq.config. +my_frame_max() -> + case application:get_env(rabbit, frame_max) of + {ok, FM} -> FM; + _ -> 131072 + end. + send_on_channel0(Sock, Method, Protocol) -> ok = rabbit_writer:internal_send_command(Sock, 0, Method, Protocol). |