diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2012-10-30 11:56:31 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2012-10-30 11:56:31 +0000 |
commit | a909713fc02ed762435de9cdc465ea9919b9928c (patch) | |
tree | fbfeffafe2a8c7b874f9b11ef8c117fb93b83c3b | |
parent | 67aaa1237373589da658bcb5c7f8bcb921fda663 (diff) | |
download | rabbitmq-server-a909713fc02ed762435de9cdc465ea9919b9928c.tar.gz |
Store name, host and peerhost as binary in the first place.
-rw-r--r-- | src/rabbit_net.erl | 7 | ||||
-rw-r--r-- | src/rabbit_reader.erl | 8 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/rabbit_net.erl b/src/rabbit_net.erl index 24843aa0..c6fc9742 100644 --- a/src/rabbit_net.erl +++ b/src/rabbit_net.erl @@ -73,8 +73,8 @@ -spec(connection_string/2 :: (socket(), 'inbound' | 'outbound') -> ok_val_or_error(string())). -spec(rdns/2 :: - (socket(), 'inbound' | 'outbound') -> {string() | 'unknown', - string() | 'unknown'}). + (socket(), 'inbound' | 'outbound') -> {binary() | 'unknown', + binary() | 'unknown'}). -endif. @@ -223,7 +223,8 @@ rdns_lookup(Sock, Fun) -> {ok, Lookup} = application:get_env(rabbit, reverse_dns_lookups), case Lookup of true -> case Fun(Sock) of - {ok, {IP, _Port}} -> rabbit_networking:tcp_host(IP); + {ok, {IP, _Port}} -> list_to_binary( + rabbit_networking:tcp_host(IP)); _ -> unknown end; _ -> unknown diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index 50ad2bf8..82781ad0 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -201,7 +201,7 @@ start_connection(Parent, ChannelSupSupPid, Collector, StartHeartbeatFun, Deb, {Host, PeerHost} = rabbit_net:rdns(Sock, inbound), State = #v1{parent = Parent, sock = ClientSock, - name = Name, + name = list_to_binary(Name), connection = #connection{ protocol = none, user = none, @@ -893,9 +893,9 @@ auth_phase(Response, 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(name, #v1{name = Name}) -> Name; +i(host, #v1{host = Host}) -> Host; +i(peer_host, #v1{peer_host = PeerHost}) -> 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, |