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

(-)java/org/apache/tomcat/util/net/AprEndpoint.java (-1 / +21 lines)
Lines 1704-1709 Link Here
1704
         */
1704
         */
1705
        public void run() {
1705
        public void run() {
1706
1706
1707
            long maintainTime = 0;
1707
            // Loop until we receive a shutdown command
1708
            // Loop until we receive a shutdown command
1708
            while (running) {
1709
            while (running) {
1709
1710
Lines 1717-1722 Link Here
1717
                }
1718
                }
1718
1719
1719
                while (sendfileCount < 1 && addS.size() < 1) {
1720
                while (sendfileCount < 1 && addS.size() < 1) {
1721
                    // Reset maintain time.
1722
                    maintainTime = 0;
1720
                    try {
1723
                    try {
1721
                        synchronized (this) {
1724
                        synchronized (this) {
1722
                            this.wait();
1725
                            this.wait();
Lines 1745-1750 Link Here
1745
                            addS.clear();
1748
                            addS.clear();
1746
                        }
1749
                        }
1747
                    }
1750
                    }
1751
1752
                    maintainTime += pollTime;
1748
                    // Pool for the specified interval
1753
                    // Pool for the specified interval
1749
                    int rv = Poll.poll(sendfilePollset, pollTime, desc, false);
1754
                    int rv = Poll.poll(sendfilePollset, pollTime, desc, false);
1750
                    if (rv > 0) {
1755
                    if (rv > 0) {
Lines 1810-1816 Link Here
1810
                            continue;
1815
                            continue;
1811
                        }
1816
                        }
1812
                    }
1817
                    }
1813
                    /* TODO: See if we need to call the maintain for sendfile poller */
1818
                    // Call maintain for the sendfile poller
1819
                    if (soTimeout > 0 && maintainTime > 1000000L && running) {
1820
                        rv = Poll.maintain(sendfilePollset, desc, true);
1821
                        maintainTime = 0;
1822
                        if (rv > 0) {
1823
                            for (int n = 0; n < rv; n++) {
1824
                                // Get the sendfile state
1825
                                SendfileData state = sendfileData.get(new Long(desc[n]));
1826
                                // Close socket and clear pool
1827
                                remove(state);
1828
                                // Destroy file descriptor pool, which should close the file
1829
                                // Close the socket, as the response would be incomplete
1830
                                Socket.destroy(state.socket);
1831
                            }
1832
                        }
1833
                    }
1814
                } catch (Throwable t) {
1834
                } catch (Throwable t) {
1815
                    log.error(sm.getString("endpoint.poll.error"), t);
1835
                    log.error(sm.getString("endpoint.poll.error"), t);
1816
                }
1836
                }

Return to bug 42925