Merge pull request #5041 from chimp1984/request-only-not-seeds-if-no-seed-available

Request only non-seed nodes if no seed nodes are available
This commit is contained in:
sqrrm 2021-01-04 10:50:10 +01:00 committed by GitHub
commit 4da1bb0c10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -375,7 +375,7 @@ public class RequestDataManager implements MessageListener, ConnectionListener,
listener.onNoPeersAvailable();
}
restart();
requestFromNonSeedNodePeers();
} else {
log.info("We could not connect to seed node {} but we have other connection attempts open.", nodeAddress.getFullAddress());
}
@ -405,6 +405,18 @@ public class RequestDataManager implements MessageListener, ConnectionListener,
// Utils
///////////////////////////////////////////////////////////////////////////////////////////
private void requestFromNonSeedNodePeers() {
List<NodeAddress> list = getFilteredNonSeedNodeList(getSortedNodeAddresses(peerManager.getReportedPeers()), new ArrayList<>());
List<NodeAddress> filteredPersistedPeers = getFilteredNonSeedNodeList(getSortedNodeAddresses(peerManager.getPersistedPeers()), list);
list.addAll(filteredPersistedPeers);
if (!list.isEmpty()) {
NodeAddress nextCandidate = list.get(0);
list.remove(nextCandidate);
requestData(nextCandidate, list);
}
}
private void restart() {
if (retryTimer == null) {
retryTimer = UserThread.runAfter(() -> {