Author: markt
Date: Fri Jan 23 19:03:26 2015
New Revision: 1654326

URL: http://svn.apache.org/r1654326
Log:
Clarify expected behaviour if the sendfile doesn't complete in-line and
fix and associated bug in the NIO refactoring.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
    tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1654326&r1=1654325&r2=1654326&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Fri Jan 23 
19:03:26 2015
@@ -1196,15 +1196,13 @@ public class NioEndpoint extends Abstrac
                     }
                     return SendfileState.DONE;
                 } else {
-                    if (!calledByProcessor) {
-                        if (log.isDebugEnabled()) {
-                            log.debug("OP_WRITE for sendfile: " + sd.fileName);
-                        }
-                        if (event) {
-                            
add(socketWrapper.getSocket(),SelectionKey.OP_WRITE);
-                        } else {
-                            reg(sk,socketWrapper,SelectionKey.OP_WRITE);
-                        }
+                    if (log.isDebugEnabled()) {
+                        log.debug("OP_WRITE for sendfile: " + sd.fileName);
+                    }
+                    if (event) {
+                        add(socketWrapper.getSocket(),SelectionKey.OP_WRITE);
+                    } else {
+                        reg(sk,socketWrapper,SelectionKey.OP_WRITE);
                     }
                     return SendfileState.PENDING;
                 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java?rev=1654326&r1=1654325&r2=1654326&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java Fri Jan 
23 19:03:26 2015
@@ -511,6 +511,16 @@ public abstract class SocketWrapperBase<
 
     public abstract void regsiterForEvent(boolean read, boolean write);
 
+    /**
+     * Starts the sendfile process. It is expected that if the sendfile process
+     * does not complete during this call that the caller <b>will not</b> add
+     * the socket to the poller (or equivalent). That is the responsibility of
+     * this method.
+     *
+     * @param sendfileData Data representing the file to send
+     *
+     * @return The state of the sendfile process after the first write.
+     */
     public abstract SendfileState processSendfile(SendfileDataBase 
sendfileData);
 
 



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

Reply via email to