Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2552,13 +2552,18 @@ private void findSocketUsingJavaNIO(InetAddress[] inetAddrs,
}
}

// if a channel was selected, make the necessary updates
// if a channel was selected, make the necessary updates
if (selectedChannel != null) {
// Note that this must be done after selector is closed. Otherwise,
// we would get an illegalBlockingMode exception at run time.
selectedChannel.configureBlocking(true);
selectedSocket = selectedChannel.socket();
//the selectedChannel has the address that is connected successfully
//convert it to a java.net.Socket object with the address
SocketAddress iadd = selectedChannel.getRemoteAddress();
selectedSocket = new Socket();
selectedSocket.connect(iadd);

result = Result.SUCCESS;

//close the channel since it is not used anymore
selectedChannel.close();
}
}

Expand Down