IGNITE-8153 Nodes fail to connect each other when SSL is enabled - Fixes #3773.
Signed-off-by: Valentin Kulichenko <valentin.kuliche...@gmail.com> Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f4de6df7 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f4de6df7 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f4de6df7 Branch: refs/heads/ignite-8201 Commit: f4de6df71b256506ce36c1c4e16533bb063782a0 Parents: a96ac04 Author: mcherkasov <mcherka...@gridgain.com> Authored: Tue Apr 10 17:23:29 2018 -0700 Committer: Valentin Kulichenko <valentin.kuliche...@gmail.com> Committed: Tue Apr 10 17:23:29 2018 -0700 ---------------------------------------------------------------------- .../ignite/internal/util/nio/ssl/BlockingSslHandler.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/f4de6df7/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java index 638106f..0099c46 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java @@ -373,9 +373,10 @@ public class BlockingSslHandler { * @throws GridNioException If failed to pass event to the next filter. */ private Status unwrapHandshake() throws SSLException, IgniteCheckedException { - // Flip input buffer so we can read the collected data. - readFromNet(); + if(!inNetBuf.hasRemaining()) + readFromNet(); + // Flip input buffer so we can read the collected data. inNetBuf.flip(); SSLEngineResult res = unwrap0(); @@ -399,7 +400,10 @@ public class BlockingSslHandler { else if (res.getStatus() == BUFFER_UNDERFLOW) { inNetBuf.compact(); - inNetBuf = expandBuffer(inNetBuf, inNetBuf.capacity() * 2); + if(inNetBuf.capacity() == inNetBuf.limit()) + inNetBuf = expandBuffer(inNetBuf, inNetBuf.capacity() * 2); + + readFromNet(); } else // prepare to be written again