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 2016/07/23 13:11:13 UTC

svn commit: r1753869 - /httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java

Author: olegk
Date: Sat Jul 23 13:11:13 2016
New Revision: 1753869

URL: http://svn.apache.org/viewvc?rev=1753869&view=rev
Log:
HTTPCORE-428: SSLIOSession#close to handle CancelledKeyException

Modified:
    httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java?rev=1753869&r1=1753868&r2=1753869&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java (original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java Sat Jul 23 13:11:13 2016
@@ -32,6 +32,7 @@ import java.net.Socket;
 import java.net.SocketAddress;
 import java.nio.ByteBuffer;
 import java.nio.channels.ByteChannel;
+import java.nio.channels.CancelledKeyException;
 import java.nio.channels.ClosedChannelException;
 import java.nio.channels.SelectionKey;
 
@@ -633,7 +634,11 @@ public class SSLIOSession implements IOS
             this.session.setSocketTimeout(1000);
         }
         this.sslEngine.closeOutbound();
-        updateEventMask();
+        try {
+            updateEventMask();
+        } catch (CancelledKeyException ex) {
+            shutdown();
+        }
     }
 
     @Override
@@ -641,14 +646,14 @@ public class SSLIOSession implements IOS
         if (this.status == CLOSED) {
             return;
         }
+        this.status = CLOSED;
+        this.session.shutdown();
 
         this.inEncrypted.release();
         this.outEncrypted.release();
         this.inPlain.release();
         this.outPlain.release();
 
-        this.status = CLOSED;
-        this.session.shutdown();
     }
 
     @Override