You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Steve Loughran (JIRA)" <ji...@apache.org> on 2012/09/06 13:39:08 UTC
[jira] [Commented] (HADOOP-8773) Improve Server#getRemoteAddress by
utilizing Server.Connection.hostAddress
[ https://issues.apache.org/jira/browse/HADOOP-8773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13449579#comment-13449579 ]
Steve Loughran commented on HADOOP-8773:
----------------------------------------
branch 1+ does exactly that
{code}
public static InetAddress getRemoteIp() {
Call call = CurCall.get();
if (call != null) {
return call.connection.socket.getInetAddress();
}
return null;
}
{code}
What version have you been working with? If it is <1.0.3, please move to a later version of Hadoop and see if the patch is still needed
> Improve Server#getRemoteAddress by utilizing Server.Connection.hostAddress
> ---------------------------------------------------------------------------
>
> Key: HADOOP-8773
> URL: https://issues.apache.org/jira/browse/HADOOP-8773
> Project: Hadoop Common
> Issue Type: Improvement
> Reporter: binlijin
> Priority: Minor
> Attachments: HADOOP-8773.patch
>
>
> Connection :
> {code}
> public String getHostAddress() {
> return hostAddress;
> }
> {code}
> Inet4Address :
> {code}
> public String getHostAddress() {
> return numericToTextFormat(getAddress());
> }
> public byte[] getAddress() {
> byte[] addr = new byte[INADDRSZ];
> addr[0] = (byte) ((address >>> 24) & 0xFF);
> addr[1] = (byte) ((address >>> 16) & 0xFF);
> addr[2] = (byte) ((address >>> 8) & 0xFF);
> addr[3] = (byte) (address & 0xFF);
> return addr;
> }
> static String numericToTextFormat(byte[] src)
> {
> return (src[0] & 0xff) + "." + (src[1] & 0xff) + "." + (src[2] & 0xff) + "." + (src[3] & 0xff);
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira