summaryrefslogtreecommitdiff
path: root/src/rabbit_reader.erl
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2012-10-29 19:08:20 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2012-10-29 19:08:20 +0000
commit67aaa1237373589da658bcb5c7f8bcb921fda663 (patch)
tree79a1c671aaa10c1764076a525ddc5005b2ec4c86 /src/rabbit_reader.erl
parent410b72f56fa88256196ac5420ebc6868476ea9f3 (diff)
parentd075a60988ba89a5302ab9724caeae4ac80d14f8 (diff)
downloadrabbitmq-server-67aaa1237373589da658bcb5c7f8bcb921fda663.tar.gz
merge default into bug23935
Diffstat (limited to 'src/rabbit_reader.erl')
-rw-r--r--src/rabbit_reader.erl25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index 2c1eeb91..50ad2bf8 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -39,19 +39,18 @@
connection_state, queue_collector, heartbeater, stats_timer,
channel_sup_sup_pid, start_heartbeat_fun, buf, buf_len,
auth_mechanism, auth_state, conserve_resources,
- last_blocked_by, last_blocked_at}).
+ last_blocked_by, last_blocked_at, host, peer_host}).
-define(STATISTICS_KEYS, [pid, recv_oct, recv_cnt, send_oct, send_cnt,
send_pend, state, last_blocked_by, last_blocked_age,
channels]).
--define(CREATION_EVENT_KEYS, [pid, name, address, port, peer_address, peer_port,
- ssl, peer_cert_subject, peer_cert_issuer,
- peer_cert_validity, auth_mechanism,
- ssl_protocol, ssl_key_exchange,
- ssl_cipher, ssl_hash,
- protocol, user, vhost, timeout, frame_max,
- client_properties]).
+-define(CREATION_EVENT_KEYS,
+ [pid, name, address, port, peer_address, peer_port, host,
+ peer_host, ssl, peer_cert_subject, peer_cert_issuer,
+ peer_cert_validity, auth_mechanism, ssl_protocol,
+ ssl_key_exchange, ssl_cipher, ssl_hash, protocol, user, vhost,
+ timeout, frame_max, client_properties]).
-define(INFO_KEYS, ?CREATION_EVENT_KEYS ++ ?STATISTICS_KEYS -- [pid]).
@@ -198,8 +197,8 @@ start_connection(Parent, ChannelSupSupPid, Collector, StartHeartbeatFun, Deb,
Name = name(Sock),
log(info, "accepting AMQP connection ~p (~s)~n", [self(), Name]),
ClientSock = socket_op(Sock, SockTransform),
- erlang:send_after(?HANDSHAKE_TIMEOUT * 1000, self(),
- handshake_timeout),
+ erlang:send_after(?HANDSHAKE_TIMEOUT * 1000, self(), handshake_timeout),
+ {Host, PeerHost} = rabbit_net:rdns(Sock, inbound),
State = #v1{parent = Parent,
sock = ClientSock,
name = Name,
@@ -225,7 +224,9 @@ start_connection(Parent, ChannelSupSupPid, Collector, StartHeartbeatFun, Deb,
auth_state = none,
conserve_resources = false,
last_blocked_by = none,
- last_blocked_at = never},
+ last_blocked_at = never,
+ host = Host,
+ peer_host = PeerHost},
try
ok = inet_op(fun () -> rabbit_net:tune_buffer_size(ClientSock) end),
recvloop(Deb, switch_callback(rabbit_event:init_stats_timer(
@@ -893,6 +894,8 @@ infos(Items, State) -> [{Item, i(Item, State)} || Item <- Items].
i(pid, #v1{}) -> self();
i(name, #v1{name = Name}) -> list_to_binary(Name);
+i(host, #v1{host = Host}) -> list_to_binary(Host);
+i(peer_host, #v1{peer_host = PeerHost}) -> list_to_binary(PeerHost);
i(address, S) -> socket_info(fun rabbit_net:sockname/1,
fun ({A, _}) -> A end, S);
i(port, S) -> socket_info(fun rabbit_net:sockname/1,