< prev index next >

src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java

Print this page

        

@@ -335,22 +335,23 @@
         // the SSL handshake following socket connection as part of the timeout.
         // So explicitly set a socket read timeout, trigger the SSL handshake,
         // then reset the timeout.
         if (socket instanceof SSLSocket) {
             SSLSocket sslSocket = (SSLSocket) socket;
-            int socketTimeout = sslSocket.getSoTimeout();
             if (!IS_HOSTNAME_VERIFICATION_DISABLED) {
                 SSLParameters param = sslSocket.getSSLParameters();
                 param.setEndpointIdentificationAlgorithm("LDAPS");
                 sslSocket.setSSLParameters(param);
             }
             if (connectTimeout > 0) {
+                int socketTimeout = sslSocket.getSoTimeout();
                 sslSocket.setSoTimeout(connectTimeout); // reuse full timeout value
-            }
             sslSocket.startHandshake();
             sslSocket.setSoTimeout(socketTimeout);
         }
+            
+        }
         return socket;
     }
 
     ////////////////////////////////////////////////////////////////////////////
     //
< prev index next >