mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8268965: TCP Connection Reset when connecting simple socket to SSL server
Reviewed-by: xuelei
This commit is contained in:
parent
4f322a9b6c
commit
6f171b9f0d
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