From c81e82bc26c309d2875b9eb4b946cabe6c0e9481 Mon Sep 17 00:00:00 2001 From: eletuchy Date: Tue, 26 Feb 2008 12:11:29 +0000 Subject: [PATCH] [thrift] don't do a reverse DNS lookup for every erlang thrift request 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 | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/lib/erl/src/transport/tErlAcceptor.erl b/lib/erl/src/transport/tErlAcceptor.erl index bcfcb9a5..c2c8f9cc 100644 --- a/lib/erl/src/transport/tErlAcceptor.erl +++ b/lib/erl/src/transport/tErlAcceptor.erl @@ -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]). -- 2.17.1