Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

allow global search if res. observer disabled index transmission

lotus945e0ba5a5b1
diff --git a/.classpath b/.classpath
index 702522802..278d583c8 100644
--- a/.classpath
+++ b/.classpath
@@ -18,24 +18,24 @@
<classpathentry exported="true" kind="lib" path="lib/commons-io-1.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-fileupload-1.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/servlet-api.jar"/>
- <classpathentry kind="lib" path="lib/xerces.jar"/>
- <classpathentry kind="lib" path="lib/bzip2.jar"/>
- <classpathentry kind="lib" path="lib/mysql-connector-java-5.1.7-bin.jar"/>
- <classpathentry kind="lib" path="lib/bcmail-jdk14-139.jar"/>
- <classpathentry kind="lib" path="lib/bcprov-jdk14-139.jar"/>
- <classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
- <classpathentry kind="lib" path="lib/J7Zip-modified.jar"/>
- <classpathentry kind="lib" path="lib/jakarta-oro-2.0.7.jar"/>
- <classpathentry kind="lib" path="lib/jsch-0.1.21.jar"/>
- <classpathentry kind="lib" path="lib/log4j-1.2.9.jar"/>
- <classpathentry kind="lib" path="lib/webcat-0.1-swf.jar"/>
- <classpathentry kind="lib" path="lib/activation.jar"/>
- <classpathentry kind="lib" path="lib/commons-jxpath-1.3.jar"/>
- <classpathentry kind="lib" path="lib/pdfbox-0.8.0-incubating.jar"/>
- <classpathentry kind="lib" path="lib/fontbox-0.8.0-incubating.jar"/>
- <classpathentry kind="lib" path="lib/poi-3.5-FINAL-20090928.jar"/>
- <classpathentry kind="lib" path="lib/poi-scratchpad-3.5-FINAL-20090928.jar"/>
- <classpathentry kind="lib" path="libt/junit-4.7.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+ <classpathentry exported="true" kind="lib" path="lib/xerces.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/bzip2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/mysql-connector-java-5.1.7-bin.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/bcmail-jdk14-139.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/bcprov-jdk14-139.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-codec-1.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/J7Zip-modified.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jakarta-oro-2.0.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jsch-0.1.21.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/log4j-1.2.9.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/webcat-0.1-swf.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/activation.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-jxpath-1.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/pdfbox-0.8.0-incubating.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/fontbox-0.8.0-incubating.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/poi-3.5-FINAL-20090928.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/poi-scratchpad-3.5-FINAL-20090928.jar"/>
+ <classpathentry exported="true" kind="lib" path="libt/junit-4.7.jar"/>
+ <classpathentry exported="true" kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="gen"/>
</classpath>
diff --git a/defaults/yacy.init b/defaults/yacy.init
index a6080987e..8929e38bf 100644
--- a/defaults/yacy.init
+++ b/defaults/yacy.init
@@ -903,11 +903,12 @@ compare_yacy.right = YaCy
# minimum free disk space for crawling (MiB)
disk.free = 3000
-# minimum for DHT or 1/5th of former, whatever is max
+# minimum for DHT
disk.free.hardlimit = 1000
# minimum memory to accept dht-in (KB)
memory.acceptDHT = 50000
+memory.disabledDHT = false
# setting if execution of CGI files is allowed or not
cgi.allow = false
diff --git a/htroot/ConfigNetwork_p.java b/htroot/ConfigNetwork_p.java
index f0f8d6797..31002f8f1 100644
--- a/htroot/ConfigNetwork_p.java
+++ b/htroot/ConfigNetwork_p.java
@@ -133,6 +133,7 @@ public class ConfigNetwork_p {
} else {
sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
sb.peers.mySeed().setFlagAcceptRemoteIndex(false);
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_AUTODISABLED, false);
}
if (post.get("indexReceiveBlockBlacklist", "").equals("on")) {
diff --git a/htroot/index.java b/htroot/index.java
index d2ec7ddbf..9c4734dc9 100644
--- a/htroot/index.java
+++ b/htroot/index.java
@@ -75,7 +75,8 @@ public class index {
final int type = (post == null) ? 0 : post.getInt("type", 0);
final boolean indexDistributeGranted = sb.getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW, true);
- final boolean indexReceiveGranted = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
+ final boolean indexReceiveGranted = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true) ||
+ sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_AUTODISABLED, true);
//global = global && indexDistributeGranted && indexReceiveGranted;
// search domain
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 011de6ce7..a3789c57f 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -191,7 +191,8 @@ public class yacysearch {
}
// SEARCH
- final boolean indexReceiveGranted = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
+ final boolean indexReceiveGranted = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true) ||
+ sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_AUTODISABLED, true);
global = global && indexReceiveGranted; // if the user does not want indexes from remote peers, it cannot be a global search
//final boolean offline = yacyCore.seedDB.mySeed().isVirgin();
@@ -430,7 +431,7 @@ public class yacysearch {
// prepare search properties
//final boolean yacyonline = ((sb.webIndex.seedDB != null) && (sb.webIndex.seedDB.mySeed() != null) && (sb.webIndex.seedDB.mySeed().getPublicAddress() != null));
- final boolean globalsearch = (global) /* && (yacyonline)*/ && (sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false));
+ final boolean globalsearch = (global) && indexReceiveGranted; /* && (yacyonline)*/
// do the search
final TreeSet<byte[]> queryHashes = Word.words2hashes(query[0]);
diff --git a/source/de/anomic/crawler/ResourceObserver.java b/source/de/anomic/crawler/ResourceObserver.java
index f1d15642b..bcf01696f 100644
--- a/source/de/anomic/crawler/ResourceObserver.java
+++ b/source/de/anomic/crawler/ResourceObserver.java
@@ -47,7 +47,6 @@ public class ResourceObserver {
private int normalizedDiskFree = HIGH;
private int normalizedMemoryFree = HIGH;
- private boolean disabledDHT = false;
public ResourceObserver(final Switchboard sb) {
this.sb = sb;
@@ -86,16 +85,16 @@ public class ResourceObserver {
log.logInfo("disabling index receive");
sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
sb.peers.mySeed().setFlagAcceptRemoteIndex(false);
- disabledDHT = true;
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_AUTODISABLED, true);
}
}
else {
- if(disabledDHT) { // we were wrong!
+ if(sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_AUTODISABLED, false)) { // we were wrong!
log.logInfo("enabling index receive");
sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
sb.peers.mySeed().setFlagAcceptRemoteIndex(true);
- disabledDHT = false;
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_AUTODISABLED, false);
}
log.logInfo("resources ok");
}
diff --git a/source/de/anomic/search/SwitchboardConstants.java b/source/de/anomic/search/SwitchboardConstants.java
index a994f4655..018324266 100644
--- a/source/de/anomic/search/SwitchboardConstants.java
+++ b/source/de/anomic/search/SwitchboardConstants.java
@@ -393,6 +393,7 @@ public final class SwitchboardConstants {
public static final String DISK_FREE_HARDLIMIT = "disk.free.hardlimit";
public static final String MEMORY_ACCEPTDHT = "memory.acceptDHT";
+ public static final String INDEX_RECEIVE_AUTODISABLED = "memory.disabledDHT";
/*
* Some constants