Author: markt
Date: Tue Oct  8 13:28:44 2013
New Revision: 1530269

URL: http://svn.apache.org/r1530269
Log:
Ensure sendfile is enabled by default for APR.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1530269&r1=1530268&r2=1530269&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Tue Oct  8 
13:28:44 2013
@@ -150,8 +150,19 @@ public class AprEndpoint extends Abstrac
     /**
      * Use sendfile for sending static files.
      */
-    protected boolean useSendfile = Library.APR_HAS_SENDFILE;
-    public void setUseSendfile(boolean useSendfile) { this.useSendfile = 
useSendfile; }
+    protected boolean useSendfile = false;
+    /*
+     * When the endpoint is created and configured, the APR library will not
+     * have been initialised. This flag is used to determine if the default
+     * value of useSendFile should be changed if the APR library indicates it
+     * supports send file once it has been initialised. If useSendFile is set
+     * by configuration, that configuration will always take priority.
+     */
+    private boolean useSendFileSet = false;
+    public void setUseSendfile(boolean useSendfile) {
+        useSendFileSet = true;
+        this.useSendfile = useSendfile;
+    }
     @Override
     public boolean getUseSendfile() { return useSendfile; }
 
@@ -606,6 +617,9 @@ public class AprEndpoint extends Abstrac
             pollerThread.start();
 
             // Start sendfile thread
+            if (!useSendFileSet) {
+                useSendfile = Library.APR_HAS_SENDFILE;
+            }
             if (useSendfile) {
                 sendfile = new Sendfile();
                 sendfile.init();



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

Reply via email to