mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8209333: Socket reset issue for TLS 1.3 socket close
Reviewed-by: jnimeh
This commit is contained in:
parent
d1597bb1cb
commit
ad47b4c4cc
5 changed files with 349 additions and 3 deletions
|
@ -608,7 +608,12 @@ public final class SSLSocketImpl
|
|||
}
|
||||
} else {
|
||||
if (!conContext.isInboundClosed()) {
|
||||
conContext.inputRecord.close();
|
||||
try (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()) {
|
||||
|
@ -907,6 +912,30 @@ public final class SSLSocketImpl
|
|||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue