You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by sz...@apache.org on 2011/05/17 19:41:15 UTC
svn commit: r1104426 - in /hadoop/common/trunk: CHANGES.txt
src/java/org/apache/hadoop/ipc/Server.java
Author: szetszwo
Date: Tue May 17 17:41:14 2011
New Revision: 1104426
URL: http://svn.apache.org/viewvc?rev=1104426&view=rev
Log:
HADOOP-7282. ipc.Server.getRemoteIp() may return null. Contributed by John George
Modified:
hadoop/common/trunk/CHANGES.txt
hadoop/common/trunk/src/java/org/apache/hadoop/ipc/Server.java
Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=1104426&r1=1104425&r2=1104426&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Tue May 17 17:41:14 2011
@@ -226,6 +226,9 @@ Trunk (unreleased changes)
HADOOP-7292. Fix racy test case TestSinkQueue. (Luke Lu via todd)
+ HADOOP-7282. ipc.Server.getRemoteIp() may return null. (John George
+ via szetszwo)
+
Release 0.22.0 - Unreleased
INCOMPATIBLE CHANGES
Modified: hadoop/common/trunk/src/java/org/apache/hadoop/ipc/Server.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/ipc/Server.java?rev=1104426&r1=1104425&r2=1104426&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/ipc/Server.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/ipc/Server.java Tue May 17 17:41:14 2011
@@ -154,7 +154,7 @@ public abstract class Server {
public static InetAddress getRemoteIp() {
Call call = CurCall.get();
if (call != null) {
- return call.connection.socket.getInetAddress();
+ return call.connection.getHostInetAddress();
}
return null;
}
@@ -166,6 +166,13 @@ public abstract class Server {
return (addr == null) ? null : addr.getHostAddress();
}
+
+ /** Return true if the invocation was through an RPC.
+ */
+ public static boolean isRpcInvocation() {
+ return CurCall.get() != null;
+ }
+
private String bindAddress;
private int port; // port we listen on
private int handlerCount; // number of handler threads