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 2009/05/03 23:16:36 UTC

svn commit: r771126 - in /httpcomponents/httpcore/trunk: RELEASE_NOTES.txt httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java

Author: olegk
Date: Sun May  3 21:16:34 2009
New Revision: 771126

URL: http://svn.apache.org/viewvc?rev=771126&view=rev
Log:
* SSLIOSession#isAppOutputReady and SSLIOSession#isAppInputReady no longer ignore the application event mask causing I/O event notifications for unrequested type of events

* Fixed incorrect handling of end-of-stream condition in the SSLIOSession#readPlain method (follow-up to HTTPCORE-193)

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

Modified: httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?rev=771126&r1=771125&r2=771126&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Sun May  3 21:16:34 2009
@@ -1,6 +1,10 @@
 Changes since 4.0
 -------------------
 
+* SSLIOSession#isAppOutputReady and SSLIOSession#isAppInputReady no longer ignore the application 
+  event mask causing I/O event notifications for unrequested type of events.  
+  Contributed by Oleg Kalnichevski <olegk at apache.org> 
+
 * [HTTPCORE-155] Compatibility mode with IBM JRE and other JREs with naive (broken) implementation 
   of SelectionKey.
   Cotributed by Marc Beyerle <marc.beyerle at de.ibm.com> and Oleg Kalnichevski <olegk at apache.org> 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java?rev=771126&r1=771125&r2=771126&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java Sun May  3 21:16:34 2009
@@ -36,6 +36,7 @@
 import java.net.SocketAddress;
 import java.nio.ByteBuffer;
 import java.nio.channels.ByteChannel;
+import java.nio.channels.SelectionKey;
 
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
@@ -268,14 +269,16 @@
         doHandshake();
         decryptData();
         // Some decrypted data is available or at the end of stream
-        return this.inPlain.position() > 0 || this.status != ACTIVE;
+        return (this.appEventMask & SelectionKey.OP_READ) > 0 
+            && (this.inPlain.position() > 0 || (this.endOfStream && this.status == ACTIVE));
     }
     
     /**
      * @throws IOException - not thrown currently
      */
     public synchronized boolean isAppOutputReady() throws IOException {
-        return this.status == ACTIVE
+        return (this.appEventMask & SelectionKey.OP_WRITE) > 0
+            && this.status == ACTIVE
             && this.sslEngine.getHandshakeStatus() == HandshakeStatus.NOT_HANDSHAKING;
     }
 
@@ -331,10 +334,10 @@
             this.inPlain.compact();
             return n; 
         } else {
-            if (this.status == ACTIVE) {
-                return 0;
-            } else {
+            if (this.endOfStream) {
                 return -1;
+            } else {
+                return 0;
             }
         }
     }