You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/01/10 09:42:05 UTC

svn commit: r1557054 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/coyote/http11/Http11NioProcessor.java webapps/docs/changelog.xml

Author: markt
Date: Fri Jan 10 08:42:05 2014
New Revision: 1557054

URL: http://svn.apache.org/r1557054
Log:
Fix sendfile support on NIO

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1556957

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1557054&r1=1557053&r2=1557054&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Fri Jan 10 08:42:05 2014
@@ -276,6 +276,7 @@ public class Http11NioProcessor extends 
     @Override
     protected boolean breakKeepAliveLoop(
             SocketWrapper<NioChannel> socketWrapper) {
+        openSocket = keepAlive;
         // Do sendfile as needed: add socket to sendfile and end
         if (sendfileData != null && !error) {
             ((KeyAttachment) socketWrapper).setSendfileData(sendfileData);
@@ -283,8 +284,16 @@ public class Http11NioProcessor extends 
             SelectionKey key = socketWrapper.getSocket().getIOChannel().keyFor(
                     socketWrapper.getSocket().getPoller().getSelector());
             //do the first write on this thread, might as well
-            openSocket = socketWrapper.getSocket().getPoller().processSendfile(key,
-                    (KeyAttachment) socketWrapper, true);
+            if (socketWrapper.getSocket().getPoller().processSendfile(key,
+                    (KeyAttachment) socketWrapper, true)) {
+                sendfileInProgress = true;
+            } else {
+                // Write failed
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("http11processor.sendfile.error"));
+                }
+                error = true;
+            }
             return true;
         }
         return false;

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1557054&r1=1557053&r2=1557054&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Jan 10 08:42:05 2014
@@ -82,6 +82,10 @@
         Avoid possible NPE if a content type is specified without a character
         set. (markt)
       </fix>
+      <fix>
+        <bug>55976</bug>: Fix sendfile support for the HTTP NIO connector.
+        (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">



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