src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java

Print this page

        

*** 394,403 **** --- 394,406 ---- * resolution should not be performed for endpoint identification. */ static final boolean trustNameService = Debug.getBooleanProperty("jdk.tls.trustNameService", false); + static final int retryCloseAttempts = + Debug.getIntegerProperty("jdk.tls.closeRetries", 5); + // // CONSTRUCTORS AND INITIALIZATION CODE // /**
*** 1792,1812 **** + getConnectionState()); } try { int state; while (((state = getConnectionState()) != cs_CLOSED) && (state != cs_ERROR) && (state != cs_APP_CLOSED)) { // Ask for app data and then throw it away try { readRecord(true); } catch (SocketTimeoutException e) { ! // if time out, ignore the exception and continue } } } catch (IOException e) { if (debug != null && Debug.isOn("ssl")) { System.out.println(Thread.currentThread().getName() + ", Exception while waiting for close " +e); } --- 1795,1825 ---- + getConnectionState()); } try { int state; + int retryCount = 0; while (((state = getConnectionState()) != cs_CLOSED) && (state != cs_ERROR) && (state != cs_APP_CLOSED)) { // Ask for app data and then throw it away try { readRecord(true); } catch (SocketTimeoutException e) { ! // if time out, retry as specified by retryCloseAttempts ! if (retryCloseAttempts > 0 && retryCount == retryCloseAttempts) { ! if ((debug != null) && Debug.isOn("ssl")) { ! System.out.println( ! Thread.currentThread().getName() + ! ", received Exception: " + e); } + fatal((byte)(-1), "Did not receive close_notify from peer", e); } + retryCount++; + } + } } catch (IOException e) { if (debug != null && Debug.isOn("ssl")) { System.out.println(Thread.currentThread().getName() + ", Exception while waiting for close " +e); }