solomax commented on code in PR #260:
URL: https://github.com/apache/openjpa/pull/260#discussion_r4465706711
##########
openjpa-kernel/src/main/java/org/apache/openjpa/event/TCPRemoteCommitProvider.java:
##########
@@ -236,40 +261,18 @@ public void setAddresses(final String names) throws
UnknownHostException {
String[] toks = StringUtil.split(names, ";", 0);
_addresses = new ArrayList<>(toks.length);
- InetAddress localhost = InetAddress.getLocalHost();
- String localhostName = localhost.getHostName();
-
for (String host : toks) {
- String hostname;
- int tmpPort;
- int colon = host.indexOf(':');
- if (colon != -1) {
- hostname = host.substring(0, colon);
- tmpPort = Integer.parseInt(host.substring(colon + 1));
- } else {
- hostname = host;
- tmpPort = DEFAULT_PORT;
- }
- InetAddress tmpAddress = InetAddress.getByName(hostname);
-
- // bleair: For each address we would rather make use of
- // the jdk1.4 isLinkLocalAddress () || isLoopbackAddress ().
- // (Though in practice on win32 they don't work anyways!)
- // Instead we will check hostname. Not perfect, but
- // it will match often enough (people will typically
- // use the DNS machine names and be cutting/pasting.)
- if (localhostName.equals(hostname)) {
+ HostAddress newAddress = new HostAddress(host);
+ if (localAddresses.contains(newAddress._address)) {
Review Comment:
Original implementation peek random IP address and treat it as local (it use
the IP at my VPN network).
I can compare with `bindAddress`, no sure if anyone can set up such
configuration ...
Will add your code to separate on `_port` :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]