8263779: SSLEngine reports NEED_WRAP continuously without producing any further output

Reviewed-by: wetmore
This commit is contained in:
Xue-Lei Andrew Fan 2021-04-28 03:21:47 +00:00
parent 889d246681
commit 1a37bce5af
4 changed files with 40 additions and 44 deletions

View file

@ -1417,8 +1417,10 @@ public final class SSLSocketImpl
conContext.isNegotiated) {
return 0;
}
} catch (SSLException | InterruptedIOException | SocketException se) {
// don't change exception in case of timeouts or interrupts or SocketException
} catch (SSLException |
InterruptedIOException | SocketException se) {
// Don't change exception in case of timeouts or interrupts
// or SocketException.
throw se;
} catch (IOException ioe) {
throw new SSLException("readHandshakeRecord", ioe);
@ -1474,8 +1476,10 @@ public final class SSLSocketImpl
buffer.position() > 0) {
return buffer;
}
} catch (SSLException | InterruptedIOException | SocketException se) {
// don't change exception in case of timeouts or interrupts or SocketException.
} catch (SSLException |
InterruptedIOException | SocketException se) {
// Don't change exception in case of timeouts or interrupts
// or SocketException.
throw se;
} catch (IOException ioe) {
throw new SSLException("readApplicationRecord", ioe);
@ -1483,7 +1487,8 @@ public final class SSLSocketImpl
}
//
// couldn't read, due to some kind of error
// Couldn't read, due to some kind of error or inbound
// has been closed.
//
return null;
}
@ -1686,7 +1691,7 @@ public final class SSLSocketImpl
if (cause instanceof SocketException) {
try {
conContext.fatal(alert, cause);
throw conContext.fatal(alert, cause);
} catch (Exception e) {
// Just delivering the fatal alert, re-throw the socket exception instead.
}
@ -1748,7 +1753,8 @@ public final class SSLSocketImpl
// If conContext.isInputCloseNotified is false, close the
// connection, no wait for more peer response. Otherwise,
// may wait for peer close_notify.
closeSocket(!conContext.isInputCloseNotified);
closeSocket(conContext.isNegotiated &&
!conContext.isInputCloseNotified);
} finally {
tlsIsClosed = true;
}