Skip to content

Commit

Permalink
Merge pull request #311 from ropalka/XNIO-425_3.8
Browse files Browse the repository at this point in the history
[XNIO-425] Use user provided XNIO client bind address (if available) when creating secured connections
  • Loading branch information
fl4via committed Oct 18, 2023
2 parents 75cdba5 + 61a6ec8 commit 19baf00
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/src/main/java/org/xnio/XnioIoThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
*/
@SuppressWarnings("unused")
public abstract class XnioIoThread extends Thread implements XnioExecutor, XnioIoFactory {

private static final InetSocketAddress ANY_INET_ADDRESS = new InetSocketAddress(0);
private final XnioWorker worker;
private final int number;

Expand Down Expand Up @@ -261,6 +263,8 @@ public IoFuture<StreamConnection> openStreamConnection(SocketAddress bindAddress
throw msg.mismatchSockType(bindAddress.getClass(), destination.getClass());
}
if (destination instanceof InetSocketAddress) {
final InetSocketAddress configuredAddress = ANY_INET_ADDRESS.equals(bindAddress) ? getWorker().getBindAddressTable().get(((InetSocketAddress) destination).getAddress()) : null;
bindAddress = configuredAddress != null ? configuredAddress : bindAddress;
return openTcpStreamConnection((InetSocketAddress) bindAddress, (InetSocketAddress) destination, openListener, bindListener, optionMap);
} else if (destination instanceof LocalSocketAddress) {
return openLocalStreamConnection((LocalSocketAddress) bindAddress, (LocalSocketAddress) destination, openListener, bindListener, optionMap);
Expand Down

0 comments on commit 19baf00

Please sign in to comment.