summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2014-01-10 14:00:36 +0000
committerSimon MacMullen <simon@rabbitmq.com>2014-01-10 14:00:36 +0000
commit3c923041050e473a8578f686c8881d3e8a8b9906 (patch)
treecb63cdb60788224766829418504252af01900c2d
parente47a2844081265fd83451548ad49e252e9e677ed (diff)
downloadrabbitmq-server-git-3c923041050e473a8578f686c8881d3e8a8b9906.tar.gz
This code can now be invoked in the context of the Erlang client, in which case we are not guaranteed that the env key will be there at all.
-rw-r--r--src/rabbit_net.erl7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/rabbit_net.erl b/src/rabbit_net.erl
index e8c9681874..401b8ab1cd 100644
--- a/src/rabbit_net.erl
+++ b/src/rabbit_net.erl
@@ -222,10 +222,9 @@ maybe_ntoab(Addr) when is_tuple(Addr) -> rabbit_misc:ntoab(Addr);
maybe_ntoab(Host) -> Host.
rdns(Addr) ->
- {ok, Lookup} = application:get_env(rabbit, reverse_dns_lookups),
- case Lookup of
- true -> list_to_binary(rabbit_networking:tcp_host(Addr));
- _ -> Addr
+ case application:get_env(rabbit, reverse_dns_lookups) of
+ {ok, true} -> list_to_binary(rabbit_networking:tcp_host(Addr));
+ _ -> Addr
end.
sock_funs(inbound) -> {fun peername/1, fun sockname/1};