RFR: 8231260: (dc) DatagramChannel::disconnect changes the port of the local address to 0 (lnx)
Alan Bateman
Alan.Bateman at oracle.com
Fri Oct 4 16:15:06 UTC 2019
On 04/10/2019 17:03, Florian Weimer wrote:
> :
> The kernel will do it atomically during connect, so there is no race
> condition. With the change above, the port is selected and opened,
> packets can arrive (from arbitrary addresses), and only then the socket
> is bound to the remote address.
>
I don't see an issue here as packets in the socket buffer are read and
discarded after the address association is setup in the kernel.
Also just to say that the spec has already set expectations that connect
would do an explicit bind ("If this channel's socket is not bound ...")
although that is only behavior observable when running with a custom
security manager.
-Alan.
More information about the nio-dev
mailing list