hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r573883 - /jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
Date Sat, 08 Sep 2007 17:12:16 GMT
Author: olegk
Date: Sat Sep  8 10:12:15 2007
New Revision: 573883

URL: http://svn.apache.org/viewvc?rev=573883&view=rev
Log:
Improved SSLIOSession termination logic 

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

Modified: jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java?rev=573883&r1=573882&r2=573883&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
Sat Sep  8 10:12:15 2007
@@ -249,11 +249,11 @@
         doHandshake();
         decryptData();
         // Some decrypted data is available or at the end of stream
-        return this.inPlain.position() > 0 || this.status == CLOSED;
+        return this.inPlain.position() > 0 || this.status != ACTIVE;
     }
     
     public synchronized boolean isAppOutputReady() throws IOException {
-        return this.status != CLOSED
+        return this.status == ACTIVE
             && this.sslEngine.getHandshakeStatus() == HandshakeStatus.NOT_HANDSHAKING;
     }
     
@@ -275,7 +275,7 @@
         if (src == null) {
             throw new IllegalArgumentException("Byte buffer may not be null");
         }
-        if (this.status == CLOSED) {
+        if (this.status != ACTIVE) {
             return -1;
         }
         if (this.outPlain.position() > 0) {
@@ -298,7 +298,7 @@
         if (dst == null) {
             throw new IllegalArgumentException("Byte buffer may not be null");
         }
-        if (this.status == CLOSED) {
+        if (this.status != ACTIVE) {
             return -1;
         }
         if (this.inPlain.position() > 0) {
@@ -315,22 +315,27 @@
     }
     
     public void close() {
-        if (this.status == CLOSED) {
+        if (this.status != ACTIVE) {
             return;
         }
-        this.status = CLOSED;
+        this.status = CLOSING;
         synchronized(this) {
             this.sslEngine.closeOutbound();
             updateEventMask();
         }
     }
     
+    public void shutdown() {
+        this.status = CLOSED;
+        this.session.shutdown();
+    }
+
     public int getStatus() {
         return this.status;
     }
 
     public boolean isClosed() {
-        return this.status == CLOSED;
+        return this.status != ACTIVE;
     }
 
     public synchronized boolean isInboundDone() {
@@ -341,11 +346,6 @@
         return this.sslEngine.isOutboundDone();
     }
     
-    public void shutdown() {
-        this.status = CLOSED;
-        this.session.shutdown();
-    }
-
     public ByteChannel channel() {
         return this.channel;
     }



Mime
View raw message