< prev index next >

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

Print this page

        

*** 579,588 **** --- 579,589 ---- * Brute force close the input bound. * * This method should only be called when the outbound has been closed, * but the inbound is still open. */ + @SuppressWarnings("try") private void bruteForceCloseInput( boolean hasCloseReceipt) throws IOException { if (hasCloseReceipt) { // It is not required for the initiator of the close to wait for // the responding close_notify alert before closing the read side
*** 598,608 **** shutdownInput(false); } } } else { if (!conContext.isInboundClosed()) { ! conContext.inputRecord.close(); } if ((autoClose || !isLayered()) && !super.isInputShutdown()) { super.shutdownInput(); } --- 599,614 ---- shutdownInput(false); } } } else { if (!conContext.isInboundClosed()) { ! try (InputRecord ir = conContext.inputRecord) { ! // Try the best to use up the input records and close the ! // socket gracefully, without impact the performance too ! // much. ! appInput.deplete(); ! } } if ((autoClose || !isLayered()) && !super.isInputShutdown()) { super.shutdownInput(); }
*** 897,906 **** --- 903,936 ---- } } return false; } + + /** + * Try the best to use up the input records so as to close the + * socket gracefully, without impact the performance too much. + */ + private synchronized void deplete() { + if (!conContext.isInboundClosed()) { + if (!(conContext.inputRecord instanceof SSLSocketInputRecord)) { + return; + } + + SSLSocketInputRecord socketInputRecord = + (SSLSocketInputRecord)conContext.inputRecord; + try { + socketInputRecord.deplete( + conContext.isNegotiated && (getSoTimeout() > 0)); + } catch (IOException ioe) { + if (SSLLogger.isOn && SSLLogger.isOn("ssl")) { + SSLLogger.warning( + "input stream close depletion failed", ioe); + } + } + } + } } @Override public synchronized OutputStream getOutputStream() throws IOException { if (isClosed()) {
< prev index next >