mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8268965: TCP Connection Reset when connecting simple socket to SSL server
Reviewed-by: xuelei
Backport-of: 6f171b9f0d
This commit is contained in:
parent
3d82b0e634
commit
e1d3e73d4e
2 changed files with 120 additions and 0 deletions
|
@ -1777,6 +1777,18 @@ public final class SSLSocketImpl
|
|||
}
|
||||
|
||||
if (autoClose || !isLayered()) {
|
||||
// Try to clear the kernel buffer to avoid TCP connection resets.
|
||||
if (conContext.inputRecord instanceof
|
||||
SSLSocketInputRecord inputRecord && isConnected) {
|
||||
if (appInput.readLock.tryLock()) {
|
||||
try {
|
||||
inputRecord.deplete(false);
|
||||
} finally {
|
||||
appInput.readLock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.close();
|
||||
} else if (selfInitiated) {
|
||||
if (!conContext.isInboundClosed() && !isInputShutdown()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue