File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/java.base/share/classes/sun/nio/ch Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1019,7 +1019,19 @@ private void tryFinishClose() {
10191019 private void implCloseBlockingMode () throws IOException {
10201020 synchronized (stateLock ) {
10211021 assert state < ST_CLOSING ;
1022+ boolean connected = (state == ST_CONNECTED );
10221023 state = ST_CLOSING ;
1024+
1025+ if (connected && Net .shouldShutdownWriteBeforeClose ()) {
1026+ // shutdown output when linger interval not set to 0
1027+ try {
1028+ var SO_LINGER = StandardSocketOptions .SO_LINGER ;
1029+ if ((int ) Net .getSocketOption (fd , SO_LINGER ) != 0 ) {
1030+ Net .shutdown (fd , Net .SHUT_WR );
1031+ }
1032+ } catch (IOException ignore ) { }
1033+ }
1034+
10231035 if (!tryClose ()) {
10241036 long reader = readerThread ;
10251037 long writer = writerThread ;
You can’t perform that action at this time.
0 commit comments