mirror of
https://github.com/corda/corda.git
synced 2025-06-14 05:08:18 +00:00
check connection readyness in SocketChannel.finishConnect if necessary
This commit is contained in:
@ -67,11 +67,16 @@ public class SocketChannel extends SelectableChannel
|
|||||||
|
|
||||||
public boolean finishConnect() throws IOException {
|
public boolean finishConnect() throws IOException {
|
||||||
if (! connected) {
|
if (! connected) {
|
||||||
while (blocking && ! readyToConnect) {
|
while (! readyToConnect) {
|
||||||
Selector selector = Selector.open();
|
Selector selector = Selector.open();
|
||||||
SelectionKey key = register(selector, SelectionKey.OP_CONNECT, null);
|
SelectionKey key = register(selector, SelectionKey.OP_CONNECT, null);
|
||||||
|
|
||||||
selector.select();
|
if (blocking) {
|
||||||
|
selector.select();
|
||||||
|
} else {
|
||||||
|
selector.selectNow();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
natFinishConnect(socket);
|
natFinishConnect(socket);
|
||||||
|
Reference in New Issue
Block a user