You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2018/12/07 13:12:59 UTC

httpcomponents-core git commit: Delay i/o operations on non-blocking SSL sessions until fully initialized

Repository: httpcomponents-core
Updated Branches:
  refs/heads/master 40cae2275 -> d6b9205e0


Delay i/o operations on non-blocking SSL sessions until fully initialized


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

Branch: refs/heads/master
Commit: d6b9205e0d839d0b4d1efbb5c3fa371d476eaae8
Parents: 40cae22
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Fri Dec 7 14:09:03 2018 +0100
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri Dec 7 14:10:21 2018 +0100

----------------------------------------------------------------------
 .../java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java     | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d6b9205e/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
index 98ada25..32407cd 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
@@ -614,6 +614,9 @@ public class SSLIOSession implements IOSession {
             if (this.status != ACTIVE) {
                 throw new ClosedChannelException();
             }
+            if (!this.initialized) {
+                return 0;
+            }
             final ByteBuffer outEncryptedBuf = this.outEncrypted.acquire();
             final SSLEngineResult result = doWrap(src, outEncryptedBuf);
             if (result.getStatus() == Status.CLOSED) {
@@ -629,6 +632,9 @@ public class SSLIOSession implements IOSession {
         Args.notNull(dst, "Byte buffer");
         this.session.lock().lock();
         try {
+            if (!this.initialized) {
+                return 0;
+            }
             if (this.inPlain.hasData()) {
                 // Acquire buffer
                 final ByteBuffer inPlainBuf = this.inPlain.acquire();