RFR 8231187: SelectorProvider.inheritedChannel() returns TCP socket channel for Unix domain socket
Michael McMahon
michael.x.mcmahon at oracle.com
Fri Sep 20 10:56:48 UTC 2019
Hi Alan,
On 20/09/2019, 11:42, Alan Bateman wrote:
> On 20/09/2019 10:53, Michael McMahon wrote:
>> Hi,
>>
>> This issue was reported through a recent discussion proposing an API
>> for Unix domain
>> sockets. It fixes the current erroneous behavior where TCP type
>> SocketChannels are returned
>> and instead returns a Channel type which handles connected AF_UNIX
>> sockets specifically.
>>
>> The fix also enables the whole inherited channel mechanism for Mac,
>> which up to now
>> has not been working.
>>
>> http://cr.openjdk.java.net/~michaelm/8231187/webrev.1/index.html
> Yes, I remember that bug came up in the proposal to add the API so
> it's good to get it fixed.
>
> I skimmed through the webrev. The async close doesn't look right,
> mostly missing preClose and the final close by the last thread doing
> I/O. The Unix implementation of SourceChannelImpl or SinkChannelImpl
> are the simplest examples to follow if you need it. The main issues are:
>
> - need a state field to track that the channel is closing
> - endRead need to close the channel when the state is_ST_CLOSING and
> there is no writer (the opposite for reader)
> - implCloseChannel should only close if reader and writer are both 0,
> otherwise it should preClose and signal the reader and/or writer.
>
Is the above not required only to allow draining of the socket when
SO_LINGER is enabled,
which is not supported in this case?
> A minor nit is that getFDVal can be removed, and getFD can be private
> as the channel doesn't implement SelChImpl.
>
OK
> As a precaultion, createChannel could return null if the address
> family is AF_UKNOWN.
>
OK
Thanks,
Michael.
More information about the nio-dev
mailing list