larryi      02/01/07 16:48:20

  Modified:    src/share/org/apache/tomcat/modules/server
                        Http10Interceptor.java
  Log:
  Added a delaySocketClose attribute that when true, executes a
  Thread.sleep(0)  to force a thread switch just prior to closing the socket.
  This was needed by Cactus to avoid "Socket reset by peer" errors on a
  high powered Windows XP system.
  
  Also added an setSoLinger(100) to help ensure the output is delivered.
  
  Revision  Changes    Path
  1.29      +17 -0     
jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Http10Interceptor.java
  
  Index: Http10Interceptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Http10Interceptor.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Http10Interceptor.java    7 Dec 2001 04:38:26 -0000       1.28
  +++ Http10Interceptor.java    8 Jan 2002 00:48:19 -0000       1.29
  @@ -100,9 +100,11 @@
   {
       private int      timeout = 300000;       // 5 minutes as in Apache HTTPD server
       private String reportedname;
  +    private boolean delaySocketClose = false;
   
       public Http10Interceptor() {
        super();
  +        super.setSoLinger( 100 );
        // defaults:
        this.setPort( 8080 );
       }
  @@ -120,6 +122,11 @@
       public void setReportedname( String reportedName) {
       reportedname = reportedName;
       }
  +
  +    public void setDelaySocketClose(boolean b) {
  +        delaySocketClose=b;
  +    }
  +
       // -------------------- Handler implementation --------------------
       public void setServer( Object o ) {
        this.cm=(ContextManager)o;
  @@ -197,6 +204,16 @@
            log( "Error reading request, ignored", e, Log.ERROR);
        } 
        finally {
  +            // When running tests against Tomcat on the same
  +            // system, we may need to force a thread switch
  +            // before closing the socket to give the other
  +            // end of the connection a chance to run
  +            if( delaySocketClose ) {
  +                try {
  +                    Thread.sleep(0);
  +                } catch (InterruptedException ie) { /* ignore */ }
  +            }
  +
            // recycle kernel sockets ASAP
           // XXX didn't honor HTTP/1.0 KeepAlive, should be fixed
            try { if (socket != null) socket.close (); }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to