Blocking connect logic differs on JDK versus standard C sockets.
In C sockets, a nonblocking connect followed by a select is
sufficient to finish connecting and be ready for IO.
In JDK sockets, a nonblocking connect followed by a select must
still be finished (SocketChannel.finishConnect) to set up
internal structures and move the socket out of its pending
("connection-pending"). The socket will not be usable for IO until
this finish step has been performed.
The logic here modifies IO.select to check for pending connections
after a select-for-write, and if necessary to finish the connect
process.
Fixes jruby#9304
Blocking connect logic differs on JDK versus standard C sockets.
In C sockets, a nonblocking connect followed by a select is sufficient to finish connecting and be ready for IO.
In JDK sockets, a nonblocking connect followed by a select must still be finished (SocketChannel.finishConnect) to set up internal structures and move the socket out of its pending ("connection-pending"). The socket will not be usable for IO until this finish step has been performed.
The logic here modifies IO.select to check for pending connections after a select-for-write, and if necessary to finish the connect process.
Fixes #9304