Author: remm
Date: Tue Sep 22 08:37:24 2015
New Revision: 1704480

URL: http://svn.apache.org/viewvc?rev=1704480&view=rev
Log:
Port additional improvement for 57799, to also remove the sendfile flag. It is 
used to ensure expand capability on the buffer, but expand can only happen in 
rare cases during handshake so the check is not useful.

Modified:
    tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java
    tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
    tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java
    tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java?rev=1704480&r1=1704479&r2=1704480&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java 
(original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java Tue 
Sep 22 08:37:24 2015
@@ -48,8 +48,6 @@ public class NioChannel implements ByteC
 
     protected Poller poller;
 
-    protected volatile boolean sendFile = false;
-
     public NioChannel(SocketChannel channel, ApplicationBufferHandler 
bufHandler) {
         this.sc = channel;
         this.bufHandler = bufHandler;
@@ -63,7 +61,6 @@ public class NioChannel implements ByteC
     public void reset() throws IOException {
         bufHandler.getReadBuffer().clear();
         bufHandler.getWriteBuffer().clear();
-        this.sendFile = false;
     }
 
     public int getBufferSize() {
@@ -206,15 +203,6 @@ public class NioChannel implements ByteC
         return false;
     }
 
-    public boolean isSendFile() {
-        return sendFile;
-    }
-
-    public void setSendFile(boolean s) {
-        this.sendFile = s;
-    }
-
-
     /**
      * This method should be used to check the interrupt status before
      * attempting a write.

Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1704480&r1=1704479&r2=1704480&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java 
(original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Tue 
Sep 22 08:37:24 2015
@@ -1164,7 +1164,6 @@ public class NioEndpoint extends Abstrac
 
                 //configure output channel
                 sc = attachment.getSocket();
-                sc.setSendFile(true);
                 //ssl channel is slightly different
                 WritableByteChannel wc = ((sc instanceof 
SecureNioChannel)?sc:sc.getIOChannel());
 
@@ -1231,8 +1230,6 @@ public class NioEndpoint extends Abstrac
                 log.error("",t);
                 cancelledKey(sk, SocketStatus.ERROR);
                 return false;
-            }finally {
-                if (sc!=null) sc.setSendFile(false);
             }
             return true;
         }

Modified: 
tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java?rev=1704480&r1=1704479&r2=1704480&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java 
(original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java 
Tue Sep 22 08:37:24 2015
@@ -499,9 +499,6 @@ public class SecureNioChannel extends Ni
                 throw new IOException(sm.getString("channel.nio.ssl.closing"));
             }
 
-            // Make sure we can handle expand, and that we only use one buffer
-            if ( (!this.isSendFile()) && (src != bufHandler.getWriteBuffer()) 
) throw new 
IllegalArgumentException(sm.getString("channel.nio.ssl.invalidBuffer"));
-
             if (!flush(netOutBuffer)) {
                 // We haven't emptied out the buffer yet
                 return 0;

Modified: tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml?rev=1704480&r1=1704479&r2=1704480&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Tue Sep 22 08:37:24 2015
@@ -198,6 +198,9 @@
         Remove some unnecessary code from the NIO Poller and fix
         <bug>58396</bug> as a side-effect. (markt)
       </scode>
+      <fix>
+        <bug>57799</bug>: Remove useless sendfile check for NIO SSL. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to