<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
> <a href="http://cr.openjdk.java.net/~wetmore/8282529/webrev.00" class="">http://cr.openjdk.java.net/~wetmore/8282529/webrev.00</a>
<div class="">I was wondering if the mixing of half-close and duplex-close could work as well, by adjusting the implementation code. It could be easier for developers. But your spec update looks good to me, even if we allow the three-lines closure.</div>
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class="">Xuelei</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Mar 4, 2022, at 4:46 PM, Bradford Wetmore <<a href="mailto:bradford.wetmore@oracle.com" class="">bradford.wetmore@oracle.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class=""><br class="">
On 3/2/2022 11:46 PM, xueleifan(XueleiFan) wrote:<br class="">
<br class="">
<blockquote type="cite" class="">I think you are right that this design is actually for TLSv1.3 half-close mode. For TLS 1.3, there is no duplex closure design. The close() implementation in JDK is actually a workaround for compatibility. Application can
use either the half-close mode<br class="">
socket.shutdownOutput();<br class="">
socket.shutdownInput();<br class="">
or duplex close mode for compatibilty:<br class="">
socket.close();<br class="">
Unfortunately, in practice the half-close and duplex close are mixed with three lines:<br class="">
socket.shutdownOutput();<br class="">
socket.shutdownInput();<br class="">
socket.close();<br class="">
</blockquote>
<br class="">
Yeah, I've seen that in things like Apache HttpClient Core, which has subsequently been removed.<br class="">
<br class="">
How about something like this:<br class="">
<br class="">
<a href="http://cr.openjdk.java.net/~wetmore/8282529/webrev.00/" class="">http://cr.openjdk.java.net/~wetmore/8282529/webrev.00/</a><br class="">
<br class="">
Thanks,<br class="">
<br class="">
Brad<br class="">
<br class="">
<br class="">
<br class="">
<blockquote type="cite" class="">It was not something I expected when I designed the spec for half-close mode. It should be helpful if having another iteration for the @apiNote.<br class="">
Thanks,<br class="">
Xuelei<br class="">
<blockquote type="cite" class="">On Mar 2, 2022, at 5:14 PM, Bradford Wetmore <bradford.wetmore@oracle.com> wrote:<br class="">
<br class="">
<br class="">
Hi Xuelei,<br class="">
<br class="">
I am working on some close code including the recent PR[1] for:<br class="">
<br class="">
8282529: Fix API Note in javadoc for javax.net.ssl.SSLSocket<br class="">
<br class="">
and ran into a change I hadn't noticed before.<br class="">
<br class="">
* @apiNote<br class="">
* When the connection is no longer needed, the client and server<br class="">
* applications should each close both sides of their respective connection.<br class="">
* For {@code SSLSocket} objects, for example, an application can call<br class="">
* {@link Socket#shutdownOutput()} for output stream close and call<br class="">
* {@link Socket#shutdownInput()} for input stream close.<br class="">
<br class="">
It used to be that just a single SSLSocket.close() was sufficient to completely shutdown the SSLSocket, and under the hood it closed the output/input in the right order.<br class="">
<br class="">
I believe this code still closes everything as before, but the updated @apiNote encourages the user to do a three-part shutdown instead.<br class="">
<br class="">
socket.shutdownOutput();<br class="">
socket.shutdownInput();<br class="">
socket.close(); // mostly repeats of above.<br class="">
<br class="">
This approach seems unnecessary unless the user is interested in the TLSv1.3 half-close mode.<br class="">
<br class="">
What is the rationale for recommending this way of doing closes in general? Or does this @apiNote need another iteration?<br class="">
<br class="">
Thanks,<br class="">
<br class="">
Brad<br class="">
<br class="">
[1] https://urldefense.com/v3/__https://github.com/openjdk/jdk/pull/7648__;!!ACWV5N9M2RV99hQ!cHw7i1wGs-eyCPUcrFXtAdFiUZL6aCPUGpGEQ9u56HHSuwew1j6YHapR8sSefEwr7TRXKQ$<br class="">
<br class="">
</blockquote>
</blockquote>
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>