tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lar...@apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/server Http10Interceptor.java
Date Fri, 08 Feb 2002 12:43:58 GMT
larryi      02/02/08 04:43:58

  Modified:    src/share/org/apache/tomcat/modules/server
                        Http10Interceptor.java
  Log:
  Move delay to the proper location as suggested by Bill Barker.  Make the
  attribute a number again so the length of the delay may be specified.
  
  Revision  Changes    Path
  1.33      +15 -13    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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- Http10Interceptor.java	5 Feb 2002 01:34:02 -0000	1.32
  +++ Http10Interceptor.java	8 Feb 2002 12:43:58 -0000	1.33
  @@ -100,7 +100,7 @@
   {
       private int	timeout = 300000;	// 5 minutes as in Apache HTTPD server
       private String reportedname;
  -    private boolean delaySocketClose = false;
  +    private int socketCloseDelay=-1;
   
       public Http10Interceptor() {
   	super();
  @@ -123,8 +123,8 @@
       reportedname = reportedName;
       }
   
  -    public void setDelaySocketClose(boolean b) {
  -        delaySocketClose=b;
  +    public void setSocketCloseDelay( int d ) {
  +        socketCloseDelay=d;
       }
   
       public void setProperty( String prop, String value ) {
  @@ -175,6 +175,18 @@
   	    
   	    cm.service( reqA, resA );
   
  +            // If unread input arrives after the shutdownInput() call
  +            // below and before or during the socket.close(), an error
  +            // may be reported to the client.  To help troubleshoot this
  +            // type of error, provide a configurable delay to give the
  +            // unread input time to arrive so it can be successfully read
  +            // and discarded by shutdownInput().
  +            if( socketCloseDelay >= 0 ) {
  +                try {
  +                    Thread.sleep(socketCloseDelay);
  +                } catch (InterruptedException ie) { /* ignore */ }
  +            }
  +
           // XXX didn't honor HTTP/1.0 KeepAlive, should be fixed
   	    TcpConnection.shutdownInput( socket );
   	}
  @@ -208,16 +220,6 @@
   	    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:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message