This commit is contained in:
@@ -81,23 +81,35 @@ public final class Transport {
|
|||||||
public final InetSocketAddress[] updateRemoteAddresses(final Collection<InetSocketAddress> addresses) {
|
public final InetSocketAddress[] updateRemoteAddresses(final Collection<InetSocketAddress> addresses) {
|
||||||
final TransportNode[] oldNodes = this.transportNodes;
|
final TransportNode[] oldNodes = this.transportNodes;
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
List<TransportNode> list = new ArrayList<>();
|
boolean same = false;
|
||||||
if (addresses != null) {
|
if (this.transportNodes != null && addresses != null && this.transportNodes.length == addresses.size()) {
|
||||||
for (InetSocketAddress addr : addresses) {
|
same = true;
|
||||||
if (clientAddress != null && clientAddress.equals(addr)) continue;
|
for (TransportNode node : this.transportNodes) {
|
||||||
boolean hasold = false;
|
if (!addresses.contains(node.getAddress())) {
|
||||||
for (TransportNode oldAddr : oldNodes) {
|
same = false;
|
||||||
if (oldAddr.getAddress().equals(addr)) {
|
break;
|
||||||
list.add(oldAddr);
|
|
||||||
hasold = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (hasold) continue;
|
|
||||||
list.add(new TransportNode(factory.poolmaxconns, addr));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.transportNodes = list.toArray(new TransportNode[list.size()]);
|
if (!same) {
|
||||||
|
List<TransportNode> list = new ArrayList<>();
|
||||||
|
if (addresses != null) {
|
||||||
|
for (InetSocketAddress addr : addresses) {
|
||||||
|
if (clientAddress != null && clientAddress.equals(addr)) continue;
|
||||||
|
boolean hasold = false;
|
||||||
|
for (TransportNode oldAddr : oldNodes) {
|
||||||
|
if (oldAddr.getAddress().equals(addr)) {
|
||||||
|
list.add(oldAddr);
|
||||||
|
hasold = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasold) continue;
|
||||||
|
list.add(new TransportNode(factory.poolmaxconns, addr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.transportNodes = list.toArray(new TransportNode[list.size()]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
InetSocketAddress[] rs = new InetSocketAddress[oldNodes.length];
|
InetSocketAddress[] rs = new InetSocketAddress[oldNodes.length];
|
||||||
for (int i = 0; i < rs.length; i++) {
|
for (int i = 0; i < rs.length; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user