ASF Bugzilla – Attachment 21993 Details for
Bug 45071
Sendfile on APR connector can truncate downloads.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
A better version of the patch
timeoutpatch2 (text/plain), 2.04 KB, created by
Alex Barclay
on 2008-05-23 13:39:14 UTC
(
hide
)
Description:
A better version of the patch
Filename:
MIME Type:
Creator:
Alex Barclay
Created:
2008-05-23 13:39:14 UTC
Size:
2.04 KB
patch
obsolete
>Index: java/org/apache/tomcat/util/net/AprEndpoint.java >=================================================================== >--- java/org/apache/tomcat/util/net/AprEndpoint.java (revision 659282) >+++ java/org/apache/tomcat/util/net/AprEndpoint.java (working copy) >@@ -1691,10 +1691,7 @@ > * @param data the sendfile data which should be removed > */ > protected void remove(SendfileData data) { >- int rv = Poll.remove(sendfilePollset, data.socket); >- if (rv == Status.APR_SUCCESS) { >- sendfileCount--; >- } >+ sendfileCount--; > sendfileData.remove(new Long(data.socket)); > } > >@@ -1751,7 +1748,7 @@ > > maintainTime += pollTime; > // Pool for the specified interval >- int rv = Poll.poll(sendfilePollset, pollTime, desc, false); >+ int rv = Poll.poll(sendfilePollset, pollTime, desc, true); > if (rv > 0) { > for (int n = 0; n < rv; n++) { > // Get the sendfile state >@@ -1797,6 +1794,16 @@ > // the end of not keep-alive request. > Socket.destroy(state.socket); > } >+ } else { >+ // Add this descriptor back to the poller - we do this taking out and >+ // putting back to ensure that the socket ttl gets reset each time >+ int r = Poll.add(sendfilePollset, state.socket, Poll.APR_POLLOUT); >+ if (r != Status.APR_SUCCESS) { >+ // Game over for this transfer >+ remove(state); >+ Socket.destroy(state.socket); >+ continue; >+ } > } > } > } else if (rv < 0) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 45071
:
21992
| 21993 |
22034