[thrift] don't do a reverse DNS lookup for every erlang thrift request
authoreletuchy <dev-null@apache.org>
Tue, 26 Feb 2008 12:11:29 +0000 (12:11 +0000)
committereletuchy <dev-null@apache.org>
Tue, 26 Feb 2008 12:11:29 +0000 (12:11 +0000)
Reviewed By: cpiro

Test Plan: ran a server ... verified its debug messages no longer included
     hostnames

Notes: methinks this binding is not long for this world

Revert Plan: sure ... if you don't like your dns server

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665505 13f79535-47bb-0310-9956-ffa450edef68

lib/erl/src/transport/tErlAcceptor.erl

index bcfcb9a..c2c8f9c 100644 (file)
@@ -152,21 +152,6 @@ receive_loop(This, Processor, Iprot, Oprot) ->
 %% helper functions
 
 %% @param Socket the socket in question
-%% TODO(cpiro): there probably needs to be a switch for DoLookup somewhere prominent and outside the lib,
-%% probably at the "application" level
 render_addr(Socket) ->
-    DoLookup = true,
-    {ok, {Peer, Port}} = inet:peername(Socket),
-
-    case Peer of
-        _ when DoLookup ->
-            case catch inet:gethostbyaddr(Peer) of
-                {ok, Hostent} ->
-                    thrift_utils:sformat("~s:~p", [Hostent#hostent.h_name, Port]);
-                _ ->
-                    "??"
-            end;
-
-        {A,B,C,D} when not DoLookup ->
-            thrift_utils:sformat("~p.~p.~p.~p:~p", [A,B,C,D,Port])
-    end.
+    {ok, {{A,B,C,D}, Port}} = inet:peername(Socket),
+    thrift_utils:sformat("~p.~p.~p.~p:~p", [A,B,C,D,Port]).