hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r662268 - /httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
Date Sun, 01 Jun 2008 19:23:59 GMT
Author: olegk
Date: Sun Jun  1 12:23:59 2008
New Revision: 662268

URL: http://svn.apache.org/viewvc?rev=662268&view=rev
Log:
Better handling of SSL session closure

Modified:
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java?rev=662268&r1=662267&r2=662268&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
Sun Jun  1 12:23:59 2008
@@ -184,6 +184,13 @@
     }
 
     private void updateEventMask() {
+        if (this.sslEngine.isInboundDone() && this.sslEngine.isOutboundDone()) {
+            this.status = CLOSED;
+        }
+        if (this.status == CLOSED) {
+            this.session.close();
+            return;
+        }
         // Need to toggle the event mask for this channel?
         int oldMask = this.session.getEventMask();
         int newMask = oldMask;
@@ -214,10 +221,6 @@
         this.outEncrypted.flip();
         int bytesWritten = this.session.channel().write(this.outEncrypted);
         this.outEncrypted.compact();
-        
-        if (this.sslEngine.isInboundDone() && this.sslEngine.isOutboundDone()) {
-            this.session.close();
-        }
         return bytesWritten;
     }
 
@@ -256,13 +259,9 @@
         return this.status == ACTIVE
             && this.sslEngine.getHandshakeStatus() == HandshakeStatus.NOT_HANDSHAKING;
     }
-    
+
     public synchronized void inboundTransport() throws IOException {
-        if (this.status == CLOSED) {
-            this.session.close();
-        } else {
-            updateEventMask();
-        }
+        updateEventMask();
     }
     
     public synchronized void outboundTransport() throws IOException {



Mime
View raw message