Browse Source

Added directDataRetrievalEnabled setting (default true)

Setting this to false prevents new connections being made to peers that report to have the data that is needed. This is likely only useful for testing, as disabling it in production would reduce the success rate of data retrieval.
qdn
CalDescent 3 years ago
parent
commit
feeca77436
  1. 5
      src/main/java/org/qortal/controller/arbitrary/ArbitraryDataManager.java
  2. 7
      src/main/java/org/qortal/settings/Settings.java

5
src/main/java/org/qortal/controller/arbitrary/ArbitraryDataManager.java

@ -326,6 +326,11 @@ public class ArbitraryDataManager extends Thread {
} }
private boolean shouldMakeDirectFileRequestsForSignature(String signature58) { private boolean shouldMakeDirectFileRequestsForSignature(String signature58) {
if (!Settings.getInstance().isDirectDataRetrievalEnabled()) {
// Direct connections are disabled in the settings
return false;
}
Triple<Integer, Integer, Long> request = arbitraryDataSignatureRequests.get(signature58); Triple<Integer, Integer, Long> request = arbitraryDataSignatureRequests.get(signature58);
if (request == null) { if (request == null) {

7
src/main/java/org/qortal/settings/Settings.java

@ -282,6 +282,9 @@ public class Settings {
/** Whether to allow data outside of the storage policy to be relayed between other peers */ /** Whether to allow data outside of the storage policy to be relayed between other peers */
private boolean relayModeEnabled = false; private boolean relayModeEnabled = false;
/** Whether to make connections directly with peers that have the required data */
private boolean directDataRetrievalEnabled = true;
/** Expiry time (ms) for (unencrypted) built/cached data */ /** Expiry time (ms) for (unencrypted) built/cached data */
private Long builtDataExpiryInterval = 30 * 24 * 60 * 60 * 1000L; // 30 days private Long builtDataExpiryInterval = 30 * 24 * 60 * 60 * 1000L; // 30 days
@ -835,6 +838,10 @@ public class Settings {
return this.relayModeEnabled; return this.relayModeEnabled;
} }
public boolean isDirectDataRetrievalEnabled() {
return this.directDataRetrievalEnabled;
}
public Long getBuiltDataExpiryInterval() { public Long getBuiltDataExpiryInterval() {
return this.builtDataExpiryInterval; return this.builtDataExpiryInterval;
} }

Loading…
Cancel
Save