This commit is contained in:
@@ -81,6 +81,17 @@ 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) {
|
||||||
|
boolean same = false;
|
||||||
|
if (this.transportNodes != null && addresses != null && this.transportNodes.length == addresses.size()) {
|
||||||
|
same = true;
|
||||||
|
for (TransportNode node : this.transportNodes) {
|
||||||
|
if (!addresses.contains(node.getAddress())) {
|
||||||
|
same = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!same) {
|
||||||
List<TransportNode> list = new ArrayList<>();
|
List<TransportNode> list = new ArrayList<>();
|
||||||
if (addresses != null) {
|
if (addresses != null) {
|
||||||
for (InetSocketAddress addr : addresses) {
|
for (InetSocketAddress addr : addresses) {
|
||||||
@@ -99,6 +110,7 @@ public final class Transport {
|
|||||||
}
|
}
|
||||||
this.transportNodes = list.toArray(new TransportNode[list.size()]);
|
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++) {
|
||||||
rs[i] = oldNodes[i].getAddress();
|
rs[i] = oldNodes[i].getAddress();
|
||||||
|
|||||||
Reference in New Issue
Block a user