Use full address instead of hostname

Mixing usage of host name and full name caused a few bugs in the past.
We should use only full address by default.
This commit is contained in:
Manfred Karrer 2019-04-16 23:19:54 -05:00
parent 70a950ce94
commit 683301fc23
No known key found for this signature in database
GPG Key ID: 401250966A6B2C46
3 changed files with 4 additions and 4 deletions

View File

@ -107,7 +107,7 @@ public class ArbitratorService {
.filter(data -> data.getProtectedStoragePayload() instanceof Arbitrator)
.map(data -> (Arbitrator) data.getProtectedStoragePayload())
.filter(a -> bannedArbitrators == null ||
!bannedArbitrators.contains(a.getNodeAddress().getHostName()))
!bannedArbitrators.contains(a.getNodeAddress().getFullAddress()))
.collect(Collectors.toSet());
Map<NodeAddress, Arbitrator> map = new HashMap<>();

View File

@ -60,13 +60,13 @@ public class ArbitratorSelection {
.collect(Collectors.toList());
Set<String> arbitrators = arbitratorManager.getArbitratorsObservableMap().values().stream()
.map(arbitrator -> arbitrator.getNodeAddress().getHostName())
.map(arbitrator -> arbitrator.getNodeAddress().getFullAddress())
.collect(Collectors.toSet());
String result = getLeastUsedArbitrator(lastAddressesUsedInTrades, arbitrators);
Optional<Arbitrator> optionalArbitrator = arbitratorManager.getArbitratorsObservableMap().values().stream()
.filter(e -> e.getNodeAddress().getHostName().equals(result))
.filter(e -> e.getNodeAddress().getFullAddress().equals(result))
.findAny();
checkArgument(optionalArbitrator.isPresent(), "optionalArbitrator has to be present");
return optionalArbitrator.get();

View File

@ -52,7 +52,7 @@ public class PublishTradeStatistics extends TradeTask {
NodeAddress arbitratorNodeAddress = trade.getArbitratorNodeAddress();
if (arbitratorNodeAddress != null) {
// The first 4 chars are sufficient to identify an arbitrator
String address = arbitratorNodeAddress.getHostName().substring(0, 4);
String address = arbitratorNodeAddress.getFullAddress().substring(0, 4);
extraDataMap.put(TradeStatistics2.ARBITRATOR_ADDRESS, address);
}