diff options
author | Matthew Sackman <matthew@lshift.net> | 2009-12-11 12:40:03 +0000 |
---|---|---|
committer | Matthew Sackman <matthew@lshift.net> | 2009-12-11 12:40:03 +0000 |
commit | 2438a07e89e48fc3c2791d6241c4529d0d66c4bd (patch) | |
tree | 42bdd440fb39165d05c410a2ce7f404d3c3ca310 /src | |
parent | 2ff9fe1a99356b8ba2630104bb765a32a484d0f3 (diff) | |
parent | 2ae9e594af2f0ffc64612986b5279352decfc9ab (diff) | |
download | rabbitmq-server-2438a07e89e48fc3c2791d6241c4529d0d66c4bd.tar.gz |
merging bug 21948 into default
Diffstat (limited to 'src')
-rw-r--r-- | src/rabbit_control.erl | 21 | ||||
-rw-r--r-- | src/rabbit_reader.erl | 15 |
2 files changed, 28 insertions, 8 deletions
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index e8e16189..033809d1 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -185,8 +185,8 @@ exchange name, queue name, routing key and arguments, in that order. <ConnectionInfoItem> must be a member of the list [node, address, port, peer_address, peer_port, state, channels, user, vhost, timeout, frame_max, -recv_oct, recv_cnt, send_oct, send_cnt, send_pend]. The default is to display -user, peer_address, peer_port and state. +client_properties, recv_oct, recv_cnt, send_oct, send_cnt, send_pend]. +The default is to display user, peer_address, peer_port and state. "), halt(1). @@ -362,8 +362,11 @@ format_info_item(Key, Items) -> Value when is_binary(Value) -> escape(Value); Value when is_atom(Value) -> - escape(atom_to_list(Value)); - Value -> + escape(atom_to_list(Value)); + Value = [{TableEntryKey, TableEntryType, _TableEntryValue} | _] + when is_binary(TableEntryKey) andalso is_atom(TableEntryType) -> + io_lib:format("~1000000000000p", [prettify_amqp_table(Value)]); + Value -> io_lib:format("~w", [Value]) end. @@ -406,3 +409,13 @@ escape_char([], Acc) -> list_replace(Find, Replace, List) -> [case X of Find -> Replace; _ -> X end || X <- List]. +prettify_amqp_table(Table) -> + [{escape(K), prettify_typed_amqp_value(T, V)} || {K, T, V} <- Table]. + +prettify_typed_amqp_value(Type, Value) -> + case Type of + longstr -> escape(Value); + table -> prettify_amqp_table(Value); + array -> [prettify_typed_amqp_value(T, V) || {T, V} <- Value]; + _ -> Value + end. diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index e21485b5..2c4b7fdc 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -58,7 +58,7 @@ -define(INFO_KEYS, [pid, address, port, peer_address, peer_port, recv_oct, recv_cnt, send_oct, send_cnt, send_pend, - state, channels, user, vhost, timeout, frame_max]). + state, channels, user, vhost, timeout, frame_max, client_properties]). %% connection lifecycle %% @@ -219,7 +219,8 @@ start_connection(Parent, Deb, ClientSock) -> user = none, timeout_sec = ?HANDSHAKE_TIMEOUT, frame_max = ?FRAME_MIN_SIZE, - vhost = none}, + vhost = none, + client_properties = none}, callback = uninitialized_callback, recv_ref = none, connection_state = pre_init}, @@ -558,7 +559,8 @@ handle_method0(MethodName, FieldsBin, State) -> end. handle_method0(#'connection.start_ok'{mechanism = Mechanism, - response = Response}, + response = Response, + client_properties = ClientProperties}, State = #v1{connection_state = starting, connection = Connection, sock = Sock}) -> @@ -570,7 +572,9 @@ handle_method0(#'connection.start_ok'{mechanism = Mechanism, frame_max = 131072, heartbeat = 0}), State#v1{connection_state = tuning, - connection = Connection#connection{user = User}}; + connection = Connection#connection{ + user = User, + client_properties = ClientProperties}}; handle_method0(#'connection.tune_ok'{channel_max = _ChannelMax, frame_max = FrameMax, heartbeat = ClientHeartbeat}, @@ -689,6 +693,9 @@ i(timeout, #v1{connection = #connection{timeout_sec = Timeout}}) -> Timeout; i(frame_max, #v1{connection = #connection{frame_max = FrameMax}}) -> FrameMax; +i(client_properties, #v1{connection = #connection{ + client_properties = ClientProperties}}) -> + ClientProperties; i(Item, #v1{}) -> throw({bad_argument, Item}). |