Skip to content

Commit

Permalink
Choose a specific network interface #20 -- bind DHT as well
Browse files Browse the repository at this point in the history
  • Loading branch information
atomashpolskiy committed Aug 7, 2017
1 parent 1d7e6b0 commit b43fa86
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bt-dht/bt-dht/src/main/java/bt/dht/MldhtService.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ public boolean allowMultiHoming() {

@Override
public Predicate<InetAddress> filterBindAddress() {
return address -> localAddress.equals(address);
return address -> {
boolean bothAnyLocal = address.isAnyLocalAddress() && localAddress.isAnyLocalAddress();
boolean couldUse = bothAnyLocal || localAddress.equals(address);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Filtering addresses to bind DHT server to.. Checking " + address + ".. Could use: " + couldUse);
}
return couldUse;
};
}
};
}
Expand Down

0 comments on commit b43fa86

Please sign in to comment.