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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -584,10 +584,10 @@ final class TransportContext implements ConnectionContext {
closeNotify(useUserCanceled);
}
// Note; HandshakeStatus.FINISHED status is retrieved in other places.
// Note: HandshakeStatus.FINISHED status is retrieved in other places.
HandshakeStatus getHandshakeStatus() {
if (!outputRecord.isEmpty()) {
// If no handshaking, special case to wrap alters or
// If not handshaking, special case to wrap alerts or
// post-handshake messages.
return HandshakeStatus.NEED_WRAP;
} else if (isOutboundClosed() && isInboundClosed()) {
@ -596,8 +596,7 @@ final class TransportContext implements ConnectionContext {
if (!handshakeContext.delegatedActions.isEmpty()) {
return HandshakeStatus.NEED_TASK;
} else if (!isInboundClosed()) {
if (sslContext.isDTLS() &&
!inputRecord.isEmpty()) {
if (sslContext.isDTLS() && !inputRecord.isEmpty()) {
return HandshakeStatus.NEED_UNWRAP_AGAIN;
} else {
return HandshakeStatus.NEED_UNWRAP;