Author: fhanik Date: Thu Oct 11 08:14:08 2007 New Revision: 583846 URL: http://svn.apache.org/viewvc?rev=583846&view=rev Log: forward port from 6.0
Modified: tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/net/AprEndpoint.java tomcat/sandbox/gdev6x/webapps/docs/changelog.xml Modified: tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/net/AprEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=583846&r1=583845&r2=583846&view=diff ============================================================================== --- tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/net/AprEndpoint.java (original) +++ tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/net/AprEndpoint.java Thu Oct 11 08:14:08 2007 @@ -1704,6 +1704,7 @@ */ public void run() { + long maintainTime = 0; // Loop until we receive a shutdown command while (running) { @@ -1717,6 +1718,8 @@ } while (sendfileCount < 1 && addS.size() < 1) { + // Reset maintain time. + maintainTime = 0; try { synchronized (this) { this.wait(); @@ -1745,6 +1748,8 @@ addS.clear(); } } + + maintainTime += pollTime; // Pool for the specified interval int rv = Poll.poll(sendfilePollset, pollTime, desc, false); if (rv > 0) { @@ -1810,7 +1815,22 @@ continue; } } - /* TODO: See if we need to call the maintain for sendfile poller */ + // Call maintain for the sendfile poller + if (soTimeout > 0 && maintainTime > 1000000L && running) { + rv = Poll.maintain(sendfilePollset, desc, true); + maintainTime = 0; + if (rv > 0) { + for (int n = 0; n < rv; n++) { + // Get the sendfile state + SendfileData state = sendfileData.get(new Long(desc[n])); + // Close socket and clear pool + remove(state); + // Destroy file descriptor pool, which should close the file + // Close the socket, as the response would be incomplete + Socket.destroy(state.socket); + } + } + } } catch (Throwable t) { log.error(sm.getString("endpoint.poll.error"), t); } Modified: tomcat/sandbox/gdev6x/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/webapps/docs/changelog.xml?rev=583846&r1=583845&r2=583846&view=diff ============================================================================== --- tomcat/sandbox/gdev6x/webapps/docs/changelog.xml (original) +++ tomcat/sandbox/gdev6x/webapps/docs/changelog.xml Thu Oct 11 08:14:08 2007 @@ -17,6 +17,9 @@ <body> <section name="Tomcat g6.xdev(unknown)"> <subsection name="Catalina"> + <fix> + <bug>42925</bug>: Add maintain for sendfile. (remm) + </fix> <fix><bug>43479</bug> Fix memory leak in APR connector </fix> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]