remm        02/04/09 02:27:12

  Modified:    http11/src/java/org/apache/coyote/http11
                        Http11Processor.java
  Log:
  - Add comments.
  - It seems to me that getting the remote host is expensive, while getting the
    remote address is super cheap (I don't even think it generates additional GC).
    So the action will only compute the remote host (there's a 'resolveHost' flag
    in the Catalina connector, which will completely disable resolving hosts, in which
    case, the action will never get called).
  
  Revision  Changes    Path
  1.19      +21 -10    
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
  
  Index: Http11Processor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Http11Processor.java      9 Apr 2002 08:59:48 -0000       1.18
  +++ Http11Processor.java      9 Apr 2002 09:27:12 -0000       1.19
  @@ -207,13 +207,21 @@
       /**
        * Maximum number of Keep-Alive requests to honor.
        */
  -    protected int maxKeepAliveRequests=-1;
  +    protected int maxKeepAliveRequests = -1;
   
   
  -    /** SSL support, socket - this is statefull anyway */
  +    /**
  +     * SSL information.
  +     */
       protected SSLSupport sslSupport;
  +
  +
  +    /**
  +     * Socket associated with the current connection.
  +     */
       protected Socket socket;
  -    
  +
  +
       // --------------------------------------------------------- Public Methods
   
   
  @@ -306,7 +314,7 @@
        */
       public void setSocket(Socket socket)
           throws IOException {
  -        this.socket=socket;
  +        this.socket = socket;
       }
   
   
  @@ -322,6 +330,10 @@
       public void process(InputStream input, OutputStream output)
           throws IOException {
   
  +        // Set the remote address
  +        String remoteAddr = socket.getInetAddress().getHostAddress();
  +        request.remoteAddr().setString(remoteAddr);
  +
           // Setting up the I/O
           inputBuffer.setInputStream(input);
           outputBuffer.setOutputStream(output);
  @@ -330,7 +342,7 @@
           error = false;
           keepAlive = true;
   
  -        int keepAliveLeft=maxKeepAliveRequests;
  +        int keepAliveLeft = maxKeepAliveRequests;
   
           while (started && !error && keepAlive) {
   
  @@ -352,8 +364,8 @@
   
               parseHost(request);
   
  -            if(maxKeepAliveRequests > 0 && --keepAliveLeft == 0)
  -                keepAlive=false;
  +            if (maxKeepAliveRequests > 0 && --keepAliveLeft == 0)
  +                keepAlive = false;
   
               // Process the request in the adapter
               if (!error) {
  @@ -400,7 +412,8 @@
           outputBuffer.recycle();
   
           // Recycle ssl info
  -        sslSupport=null;
  +        sslSupport = null;
  +
       }
   
   
  @@ -504,9 +517,7 @@
   
           } else if (actionCode == ActionCode.ACTION_REQ_HOST_ATTRIBUTE) {
   
  -            String remoteAddr = socket.getInetAddress().getHostAddress();
               String remoteHost = socket.getInetAddress().getHostName();
  -            request.remoteAddr().setString(remoteAddr);
               request.remoteHost().setString(remoteHost);
   
           }
  
  
  

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

Reply via email to