You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/12/21 10:28:31 UTC
ignite git commit: TcpDiscoverySpi: need check result of
sock.getSendBufferSize().
Repository: ignite
Updated Branches:
refs/heads/master 854d1a5d9 -> 0a3364453
TcpDiscoverySpi: need check result of sock.getSendBufferSize().
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0a336445
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0a336445
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0a336445
Branch: refs/heads/master
Commit: 0a336445367fb2cec202c431a8614c185da9a3ca
Parents: 854d1a5
Author: sboikov <sb...@gridgain.com>
Authored: Wed Dec 21 13:28:25 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Dec 21 13:28:25 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/spi/discovery/tcp/ServerImpl.java | 2 +-
.../ignite/spi/discovery/tcp/TcpDiscoverySpi.java | 14 +++++++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0a336445/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 50fa3bd..7cc35e4 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -2771,7 +2771,7 @@ class ServerImpl extends TcpDiscoveryImpl {
sock = spi.openSocket(addr, timeoutHelper);
- out = new BufferedOutputStream(sock.getOutputStream(), sock.getSendBufferSize());
+ out = spi.socketStream(sock);
openSock = true;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0a336445/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 45933e1..db85cc4 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -1246,6 +1246,18 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
}
/**
+ * @param sock Socket.
+ * @return Buffered stream wrapping socket stream.
+ * @throws IOException If failed.
+ */
+ final BufferedOutputStream socketStream(Socket sock) throws IOException {
+ int bufSize = sock.getSendBufferSize();
+
+ return bufSize > 0 ? new BufferedOutputStream(sock.getOutputStream(), bufSize) :
+ new BufferedOutputStream(sock.getOutputStream());
+ }
+
+ /**
* Connects to remote address sending {@code U.IGNITE_HEADER} when connection is established.
*
* @param sock Socket bound to a local host address.
@@ -1351,7 +1363,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
*/
protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg, long timeout) throws IOException,
IgniteCheckedException {
- writeToSocket(sock, new BufferedOutputStream(sock.getOutputStream(), sock.getSendBufferSize()), msg, timeout);
+ writeToSocket(sock, socketStream(sock), msg, timeout);
}
/**