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

(-)java/org/apache/coyote/http11/Http11AprProtocol.java (+5 lines)
Lines 226-231 Link Here
226
    public int getSoTimeout() { return endpoint.getSoTimeout(); }
226
    public int getSoTimeout() { return endpoint.getSoTimeout(); }
227
    public void setSoTimeout(int soTimeout) { endpoint.setSoTimeout(soTimeout); }
227
    public void setSoTimeout(int soTimeout) { endpoint.setSoTimeout(soTimeout); }
228
228
229
    public int getUnlockTimeout() { return endpoint.getUnlockTimeout(); }
230
    public void setUnlockTimeout(int unlockTimeout) {
231
        endpoint.setUnlockTimeout(unlockTimeout);
232
    }
233
229
    /**
234
    /**
230
     * The number of seconds Tomcat will wait for a subsequent request
235
     * The number of seconds Tomcat will wait for a subsequent request
231
     * before closing the connection.
236
     * before closing the connection.
(-)java/org/apache/coyote/http11/Http11Protocol.java (+5 lines)
Lines 426-431 Link Here
426
    public int getSoTimeout() { return endpoint.getSoTimeout(); }
426
    public int getSoTimeout() { return endpoint.getSoTimeout(); }
427
    public void setSoTimeout(int soTimeout) { endpoint.setSoTimeout(soTimeout); }
427
    public void setSoTimeout(int soTimeout) { endpoint.setSoTimeout(soTimeout); }
428
428
429
    public int getUnlockTimeout() { return endpoint.getUnlockTimeout(); }
430
    public void setUnlockTimeout(int unlockTimeout) {
431
        endpoint.setUnlockTimeout(unlockTimeout);
432
    }
433
429
    // HTTP
434
    // HTTP
430
    /**
435
    /**
431
     * Return the Keep-Alive policy for the connection.
436
     * Return the Keep-Alive policy for the connection.
(-)java/org/apache/tomcat/util/net/AprEndpoint.java (-5 / +21 lines)
Lines 18-23 Link Here
18
package org.apache.tomcat.util.net;
18
package org.apache.tomcat.util.net;
19
19
20
import java.net.InetAddress;
20
import java.net.InetAddress;
21
import java.net.InetSocketAddress;
21
import java.util.ArrayList;
22
import java.util.ArrayList;
22
import java.util.HashMap;
23
import java.util.HashMap;
23
import java.util.concurrent.Executor;
24
import java.util.concurrent.Executor;
Lines 399-404 Link Here
399
400
400
401
401
    /**
402
    /**
403
     * Unlock timeout.
404
     */
405
    protected int unlockTimeout = 250;
406
    public int getUnlockTimeout() { return unlockTimeout; }
407
    public void setUnlockTimeout(int unlockTimeout) {
408
        this.unlockTimeout = unlockTimeout;
409
    }
410
411
    
412
    /**
402
     * SSL engine.
413
     * SSL engine.
403
     */
414
     */
404
    protected boolean SSLEnabled = false;
415
    protected boolean SSLEnabled = false;
Lines 880-895 Link Here
880
     */
891
     */
881
    protected void unlockAccept() {
892
    protected void unlockAccept() {
882
        java.net.Socket s = null;
893
        java.net.Socket s = null;
894
        InetSocketAddress saddr = null;
883
        try {
895
        try {
884
            // Need to create a connection to unlock the accept();
896
            // Need to create a connection to unlock the accept();
885
            if (address == null) {
897
            if (address == null) {
886
                s = new java.net.Socket(InetAddress.getByName("localhost").getHostAddress(), port);
898
                saddr = new InetSocketAddress("localhost", port);
887
            } else {
899
            } else {
888
                s = new java.net.Socket(address, port);
900
                saddr = new InetSocketAddress(address,port);
889
                // setting soLinger to a small value will help shutdown the
890
                // connection quicker
891
                s.setSoLinger(true, 0);
892
            }
901
            }
902
            s = new java.net.Socket();
903
            s.setSoTimeout(soTimeout);
904
            s.setSoLinger(true ,0);
905
            if (log.isDebugEnabled()) {
906
                log.debug("About to unlock socket for: " + saddr);
907
            }
908
            s.connect(saddr, unlockTimeout);
893
        } catch(Exception e) {
909
        } catch(Exception e) {
894
            if (log.isDebugEnabled()) {
910
            if (log.isDebugEnabled()) {
895
                log.debug(sm.getString("endpoint.debug.unlock", "" + port), e);
911
                log.debug(sm.getString("endpoint.debug.unlock", "" + port), e);
(-)java/org/apache/tomcat/util/net/JIoEndpoint.java (-5 / +24 lines)
Lines 20-25 Link Here
20
import java.io.IOException;
20
import java.io.IOException;
21
import java.net.BindException;
21
import java.net.BindException;
22
import java.net.InetAddress;
22
import java.net.InetAddress;
23
import java.net.InetSocketAddress;
23
import java.net.ServerSocket;
24
import java.net.ServerSocket;
24
import java.net.Socket;
25
import java.net.Socket;
25
import java.util.concurrent.Executor;
26
import java.util.concurrent.Executor;
Lines 261-266 Link Here
261
    public ServerSocketFactory getServerSocketFactory() { return serverSocketFactory; }
262
    public ServerSocketFactory getServerSocketFactory() { return serverSocketFactory; }
262
263
263
264
265
    /**
266
     * Unlock timeout.
267
     */
268
    protected int unlockTimeout = 250;
269
    public int getUnlockTimeout() { return unlockTimeout; }
270
    public void setUnlockTimeout(int unlockTimeout) {
271
        this.unlockTimeout = unlockTimeout;
272
    }
273
274
    
264
    public boolean isRunning() {
275
    public boolean isRunning() {
265
        return running;
276
        return running;
266
    }
277
    }
Lines 617-632 Link Here
617
     */
628
     */
618
    protected void unlockAccept() {
629
    protected void unlockAccept() {
619
        Socket s = null;
630
        Socket s = null;
631
        InetSocketAddress saddr = null;
620
        try {
632
        try {
621
            // Need to create a connection to unlock the accept();
633
            // Need to create a connection to unlock the accept();
622
            if (address == null) {
634
            if (address == null) {
623
                s = new Socket(InetAddress.getByName("localhost").getHostAddress(), port);
635
                saddr = new InetSocketAddress("localhost", port);
624
            } else {
636
            } else {
625
                s = new Socket(address, port);
637
                saddr = new InetSocketAddress(address,port);
626
                    // setting soLinger to a small value will help shutdown the
627
                    // connection quicker
628
                s.setSoLinger(true, 0);
629
            }
638
            }
639
            s = new java.net.Socket();
640
            s.setSoTimeout(soTimeout);
641
            s.setSoLinger(true ,0);
642
            if (log.isDebugEnabled()) {
643
                log.debug("About to unlock socket for: " + saddr);
644
            }
645
            s.connect(saddr, unlockTimeout);
646
            if (log.isDebugEnabled()) {
647
                log.debug("Socket unlock completed for:"+saddr);
648
            } 
630
        } catch (Exception e) {
649
        } catch (Exception e) {
631
            if (log.isDebugEnabled()) {
650
            if (log.isDebugEnabled()) {
632
                log.debug(sm.getString("endpoint.debug.unlock", "" + port), e);
651
                log.debug(sm.getString("endpoint.debug.unlock", "" + port), e);
(-)java/org/apache/tomcat/util/net/NioEndpoint.java (-1 / +1 lines)
Lines 1048-1054 Link Here
1048
        try {
1048
        try {
1049
            // Need to create a connection to unlock the accept();
1049
            // Need to create a connection to unlock the accept();
1050
            if (address == null) {
1050
            if (address == null) {
1051
                 saddr = new InetSocketAddress("127.0.0.1", port);
1051
                 saddr = new InetSocketAddress("localhost", port);
1052
            } else {
1052
            } else {
1053
                 saddr = new InetSocketAddress(address,port);
1053
                 saddr = new InetSocketAddress(address,port);
1054
            }
1054
            }

Return to bug 48470