cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yu...@apache.org
Subject [02/10] cassandra git commit: Fix binding to any address in CqlBulkRecordWriter
Date Thu, 31 Dec 2015 19:01:44 GMT
Fix binding to any address in CqlBulkRecordWriter

patch by yukim; reviewed by snazy for CASSANDRA-9309


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

Branch: refs/heads/cassandra-2.2
Commit: a55fd76ddd96e3ed2d967910f0572804fcfacc2f
Parents: 0d51b65
Author: Yuki Morishita <yukim@apache.org>
Authored: Wed Jul 8 16:29:36 2015 -0500
Committer: Yuki Morishita <yukim@apache.org>
Committed: Thu Dec 31 12:40:57 2015 -0600

----------------------------------------------------------------------
 CHANGES.txt                                                 | 1 +
 .../org/apache/cassandra/net/OutboundTcpConnectionPool.java | 9 +++++----
 2 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a55fd76d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 9997e1e..0bd5485 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.13
+ * Fix binding to any address in CqlBulkRecordWriter (CASSANDRA-9309)
  * Fix the way we replace sstables after anticompaction (CASSANDRA-10831)
  * cqlsh fails to decode utf-8 characters for text typed columns (CASSANDRA-10875)
  * Log error when stream session fails (CASSANDRA-9294)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a55fd76d/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
index 66a0362..400fd35 100644
--- a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
+++ b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
@@ -131,10 +131,11 @@ public class OutboundTcpConnectionPool
         }
         else
         {
-            Socket socket = SocketChannel.open(new InetSocketAddress(endpoint, DatabaseDescriptor.getStoragePort())).socket();
-            if (Config.getOutboundBindAny() && !socket.isBound())
-                socket.bind(new InetSocketAddress(FBUtilities.getLocalAddress(), 0));
-            return socket;
+            SocketChannel channel = SocketChannel.open();
+            if (!Config.getOutboundBindAny())
+                channel.bind(new InetSocketAddress(FBUtilities.getLocalAddress(), 0));
+            channel.connect(new InetSocketAddress(endpoint, DatabaseDescriptor.getStoragePort()));
+            return channel.socket();
         }
     }
 


Mime
View raw message