mirror of
https://github.com/Qortal/qortal.git
synced 2025-07-20 03:11:21 +00:00
removed redundant data collecting, reintroduced relay timeout threshold
This commit is contained in:
parent
b2579a457c
commit
65c014b215
@ -76,15 +76,13 @@ public class ArbitraryDataFileRequestThread {
|
|||||||
LOGGER.error(e.getMessage(), e);
|
LOGGER.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processFileHashes(Long now, List<ArbitraryFileListResponseInfo> responseInfos, ArbitraryDataFileManager arbitraryDataFileManager) {
|
public void processFileHashes(Long now, List<ArbitraryFileListResponseInfo> responseInfos, ArbitraryDataFileManager arbitraryDataFileManager) {
|
||||||
if (Controller.isStopping()) {
|
if (Controller.isStopping()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ArbitraryFileListResponseInfo> toProcess = new ArrayList<>(responseInfos.size());
|
Map<String, byte[]> signatureBySignature58 = new HashMap<>(responseInfos.size());
|
||||||
|
|
||||||
Map<String, ArbitraryFileListResponseInfo> responseInfoByHash58 = new HashMap<>(responseInfos.size());
|
|
||||||
Map<String, byte[]> signatureBySignature58 = new HashMap<>(toProcess.size());
|
|
||||||
Map<String, List<ArbitraryFileListResponseInfo>> responseInfoBySignature58 = new HashMap<>();
|
Map<String, List<ArbitraryFileListResponseInfo>> responseInfoBySignature58 = new HashMap<>();
|
||||||
|
|
||||||
for( ArbitraryFileListResponseInfo responseInfo : responseInfos) {
|
for( ArbitraryFileListResponseInfo responseInfo : responseInfos) {
|
||||||
@ -119,8 +117,6 @@ public class ArbitraryDataFileRequestThread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We want to process this file, store and map data to process later
|
// We want to process this file, store and map data to process later
|
||||||
toProcess.add(responseInfo);
|
|
||||||
responseInfoByHash58.put(responseInfo.getHash58(), responseInfo);
|
|
||||||
signatureBySignature58.put(responseInfo.getSignature58(), signature);
|
signatureBySignature58.put(responseInfo.getSignature58(), signature);
|
||||||
responseInfoBySignature58
|
responseInfoBySignature58
|
||||||
.computeIfAbsent(responseInfo.getSignature58(), signature58 -> new ArrayList<>())
|
.computeIfAbsent(responseInfo.getSignature58(), signature58 -> new ArrayList<>())
|
||||||
@ -162,6 +158,17 @@ public class ArbitraryDataFileRequestThread {
|
|||||||
|
|
||||||
private void arbitraryDataFileFetcher(ArbitraryDataFileManager arbitraryDataFileManager, ArbitraryFileListResponseInfo responseInfo, ArbitraryTransactionData arbitraryTransactionData) {
|
private void arbitraryDataFileFetcher(ArbitraryDataFileManager arbitraryDataFileManager, ArbitraryFileListResponseInfo responseInfo, ArbitraryTransactionData arbitraryTransactionData) {
|
||||||
try {
|
try {
|
||||||
|
Long now = NTP.getTime();
|
||||||
|
|
||||||
|
if (now - responseInfo.getTimestamp() >= ArbitraryDataManager.ARBITRARY_RELAY_TIMEOUT ) {
|
||||||
|
|
||||||
|
Peer peer = responseInfo.getPeer();
|
||||||
|
String hash58 = responseInfo.getHash58();
|
||||||
|
String signature58 = responseInfo.getSignature58();
|
||||||
|
LOGGER.debug("Peer {} version {} didn't fetch data file {} for signature {} due to relay timeout.", peer, peer.getPeersVersionString(), hash58, signature58);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
arbitraryDataFileManager.fetchArbitraryDataFiles(
|
arbitraryDataFileManager.fetchArbitraryDataFiles(
|
||||||
responseInfo.getPeer(),
|
responseInfo.getPeer(),
|
||||||
arbitraryTransactionData.getSignature(),
|
arbitraryTransactionData.getSignature(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user