You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2013/02/08 17:57:10 UTC

[1/4] git commit: Binary protocol: avoid sending notification for 0.0.0.0

Binary protocol: avoid sending notification for 0.0.0.0

patch by slebresne; reviewed by jbellis for CASSANDRA-5227


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/27ccc433
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/27ccc433
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/27ccc433

Branch: refs/heads/trunk
Commit: 27ccc433f36f99ce42f3dd2463d2248f398fb19e
Parents: cef8eb0
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Thu Feb 7 18:40:24 2013 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Thu Feb 7 18:40:24 2013 +0100

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../org/apache/cassandra/transport/Server.java     |   16 ++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/27ccc433/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 905db57..33d6786 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -11,6 +11,7 @@
  * Correctly expire gossip states for edge cases (CASSANDRA-5216)
  * Improve handling of directory creation failures (CASSANDRA-5196)
  * Expose secondary indicies to the rest of nodetool (CASSANDRA-4464)
+ * Binary protocol: avoid sending notification for 0.0.0.0 (CASSANDRA-5227)
 
 
 1.2.1

http://git-wip-us.apache.org/repos/asf/cassandra/blob/27ccc433/src/java/org/apache/cassandra/transport/Server.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/Server.java b/src/java/org/apache/cassandra/transport/Server.java
index e999128..8bdae55 100644
--- a/src/java/org/apache/cassandra/transport/Server.java
+++ b/src/java/org/apache/cassandra/transport/Server.java
@@ -262,6 +262,17 @@ public class Server implements CassandraDaemon.Server
     private static class EventNotifier implements IEndpointLifecycleSubscriber, IMigrationListener
     {
         private final Server server;
+        private static final InetAddress bindAll;
+        static {
+            try
+            {
+                bindAll = InetAddress.getByAddress(new byte[4]);
+            }
+            catch (UnknownHostException e)
+            {
+                throw new AssertionError(e);
+            }
+        }
 
         private EventNotifier(Server server)
         {
@@ -272,7 +283,10 @@ public class Server implements CassandraDaemon.Server
         {
             try
             {
-                return InetAddress.getByName(StorageService.instance.getRpcaddress(endpoint));
+                InetAddress rpcAddress = InetAddress.getByName(StorageService.instance.getRpcaddress(endpoint));
+                // If rpcAddress == 0.0.0.0 (i.e. bound on all addresses), returning that is not very helpful,
+                // so return the internal address (which is ok since "we're bound on all addresses").
+                return rpcAddress.equals(bindAll) ? endpoint : rpcAddress;
             }
             catch (UnknownHostException e)
             {