Browse Source

svn merge -c 1104426 from trunk for HADOOP-7282.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/yahoo-merge@1127308 13f79535-47bb-0310-9956-ffa450edef68
Tsz-wo Sze 14 years ago
parent
commit
0f09ae25e2
2 changed files with 11 additions and 1 deletions
  1. 3 0
      CHANGES.txt
  2. 8 1
      src/java/org/apache/hadoop/ipc/Server.java

+ 3 - 0
CHANGES.txt

@@ -103,6 +103,9 @@ Trunk (unreleased changes)
     HADOOP-7210. Chown command is not working from FSShell
     (Uma Maheswara Rao G via todd)
 
+    HADOOP-7282. ipc.Server.getRemoteIp() may return null.  (John George
+    via szetszwo)
+
 Release 0.22.0 - Unreleased
 
   INCOMPATIBLE CHANGES

+ 8 - 1
src/java/org/apache/hadoop/ipc/Server.java

@@ -152,7 +152,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;
   }
@@ -164,6 +164,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