remm        2004/01/13 01:56:24

  Modified:    util/java/org/apache/tomcat/util/net PoolTcpEndpoint.java
  Log:
  - Fix build.
  - Also group evertything in a big try catch, with a small flag for the logging.
    That way, this critical code will be less error prone. Logging will be, but it's
    less important.
  
  Revision  Changes    Path
  1.30      +27 -21    
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java
  
  Index: PoolTcpEndpoint.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- PoolTcpEndpoint.java      13 Jan 2004 04:58:34 -0000      1.29
  +++ PoolTcpEndpoint.java      13 Jan 2004 09:56:24 -0000      1.30
  @@ -574,22 +574,22 @@
                   }
               }
            if (null != s) {
  -                endpoint.setSocketOptions( s );
  -             try {
  +
  +                TcpConnection con = null;
  +                int step = 1;
  +                try {
  +
  +                    // 1: Set socket options: timeout, linger, etc
  +                    endpoint.setSocketOptions( s );
  +
  +                    // 2: SSL handshake
  +                    step = 2;
                    if(endpoint.getServerSocketFactory()!=null) {
                           endpoint.getServerSocketFactory().handshake(s);
                    }
  -                } catch (Throwable t) {
  -                    endpoint.log.debug("Handshake failed", t);
  -                    // Try to close the socket
  -                    try {
  -                        s.close();
  -                    } catch (IOException e) {}
  -                    return;
  -                }
   
  -                TcpConnection con = null;
  -                try {
  +                    // 3: Process the connection
  +                    step = 3;
                    if( usePool ) {
                        con=(TcpConnection)connectionCache.get();
                        if( con == null ) 
  @@ -598,20 +598,26 @@
                           con = (TcpConnection) perThrData[0];
                           perThrData = (Object []) perThrData[1];
                    }
  -                 
  +
                    con.setEndpoint(endpoint);
                    con.setSocket(s);
  -                 endpoint.getConnectionHandler().processConnection(con, perThrData);
  +                 endpoint.getConnectionHandler()
  +                        .processConnection(con, perThrData);
  +
                   } catch (SocketException se) {
  -                    endpoint.log.error(
  -                       "Remote Host " + s.getInetAddress() +
  -                       " SocketException: " + se.getMessage());
  +                    endpoint.log.error
  +                        ("Remote Host " + s.getInetAddress() +
  +                         " SocketException: " + se.getMessage());
                       // Try to close the socket
                       try {
                           s.close();
                       } catch (IOException e) {}
                   } catch (Throwable t) {
  -                    endpoint.log.error("Unexpected error", t);
  +                    if (step == 2) {
  +                        endpoint.log.debug("Handshake failed", t);
  +                    } else {
  +                        endpoint.log.error("Unexpected error", t);
  +                    }
                       // Try to close the socket
                       try {
                           s.close();
  
  
  

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

Reply via email to