View | Details | Raw Unified | Return to bug 45071
Collapse All | Expand All

(-)../tc6.0.x-melodeo/java/org/apache/tomcat/util/net/AprEndpoint.java (-8 / +18 lines)
Lines 1691-1700 Link Here
1691
         * @param data the sendfile data which should be removed
1691
         * @param data the sendfile data which should be removed
1692
         */
1692
         */
1693
        protected void remove(SendfileData data) {
1693
        protected void remove(SendfileData data) {
1694
            int rv = Poll.remove(sendfilePollset, data.socket);
1694
            sendfileCount--;
1695
            if (rv == Status.APR_SUCCESS) {
1696
                sendfileCount--;
1697
            }
1698
            sendfileData.remove(new Long(data.socket));
1695
            sendfileData.remove(new Long(data.socket));
1699
        }
1696
        }
1700
1697
Lines 1751-1757 Link Here
1751
1748
1752
                    maintainTime += pollTime;
1749
                    maintainTime += pollTime;
1753
                    // Pool for the specified interval
1750
                    // Pool for the specified interval
1754
                    int rv = Poll.poll(sendfilePollset, pollTime, desc, false);
1751
                    int rv = Poll.poll(sendfilePollset, pollTime, desc, true);
1755
                    if (rv > 0) {
1752
                    if (rv > 0) {
1756
                        for (int n = 0; n < rv; n++) {
1753
                        for (int n = 0; n < rv; n++) {
1757
                            // Get the sendfile state
1754
                            // Get the sendfile state
Lines 1789-1802 Link Here
1789
                                    Socket.timeoutSet(state.socket, soTimeout * 1000);
1786
                                    Socket.timeoutSet(state.socket, soTimeout * 1000);
1790
                                    // If all done hand this socket off to a worker for
1787
                                    // If all done hand this socket off to a worker for
1791
                                    // processing of further requests
1788
                                    // processing of further requests
1792
                                    if (!processSocket(state.socket)) {
1789
                               
1793
                                        Socket.destroy(state.socket);
1790
                                    // See if this fixes problems - hand it directly to the poller first
1794
                                    }
1791
                                    //if (!processSocket(state.socket)) {
1792
                                    //    Socket.destroy(state.socket);
1793
                                    //}
1794
                                    getPoller().add(state.socket);
1795
                                } else {
1795
                                } else {
1796
                                    // Close the socket since this is
1796
                                    // Close the socket since this is
1797
                                    // the end of not keep-alive request.
1797
                                    // the end of not keep-alive request.
1798
                                    Socket.destroy(state.socket);
1798
                                    Socket.destroy(state.socket);
1799
                                }
1799
                                }
1800
                            } else {
1801
                                // Add this descriptor back to the poller - we do this taking out and
1802
                                // putting back to ensure that the socket ttl gets reset each time
1803
                                int r = Poll.add(sendfilePollset, state.socket, Poll.APR_POLLOUT);
1804
                                if (r != Status.APR_SUCCESS) {
1805
                                    // Game over for this transfer
1806
                                    remove(state);
1807
                                    Socket.destroy(state.socket);
1808
                                    continue;
1809
                                }
1800
                            }
1810
                            }
1801
                        }
1811
                        }
1802
                    } else if (rv < 0) {
1812
                    } else if (rv < 0) {

Return to bug 45071