allow global search if res. observer disabled index transmission

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6658 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
lotus 15 years ago
parent 8faeedd99a
commit 945e0ba5a5

@ -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>

@ -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

@ -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")) {

@ -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

@ -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]);

@ -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");
}

@ -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

Loading…
Cancel
Save