Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added a busy-time estimation at DHT/RWI-Receive to be done: usage of this value on client-side
orbiter7dd57a382812
diff --git a/htroot/yacy/transferRWI.html b/htroot/yacy/transferRWI.htmlindex 13a4c88a6..b71a9a68a 100644--- a/htroot/yacy/transferRWI.html+++ b/htroot/yacy/transferRWI.html@@ -2,3 +2,4 @@ version=#[version]#uptime=#[uptime]#unknownURL=#[unknownURL]#result=#[result]#+pause=#[pause]#diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.javaindex 29f2788cc..03f18497e 100644--- a/htroot/yacy/transferRWI.java+++ b/htroot/yacy/transferRWI.java@@ -78,17 +78,27 @@ public final class transferRWI {final int entryc = Integer.parseInt(post.get("entryc", "")); // number of entries in indexesbyte[] indexes = post.get("indexes", "").getBytes(); // the indexes, as list of word entriesboolean granted = sb.getConfig("allowReceiveIndex", "false").equals("true");-- if (sb.wordIndex.kSize() > 1000) granted = false; // don't accept more words if there are too many words to flush+ final yacySeed otherPeer = yacyCore.seedDB.get(iam);+ final String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));// response values- String result = "";+ String result = "ok";StringBuffer unknownURLs = new StringBuffer();+ int pause = 0;- final yacySeed otherPeer = yacyCore.seedDB.get(iam);- final String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));-- if (granted) {+ if (!granted) {+ // we dont want to receive indexes+ sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". Not granted.");+ result = "not_granted";+ pause = 0;+ } else if (sb.wordIndex.kSize() > 1000) {+ // we are too busy to receive indexes+ sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". We are too busy (buffersize=" + sb.wordIndex.kSize() + ").");+ granted = false; // don't accept more words if there are too many words to flush+ result = "busy";+ pause = 60000;+ } else {+ // we want and can receive indexes// log value status (currently added to find outOfMemory errorsb.getLog().logFine("Processing " + indexes.length + " bytes / " + wordc + " words / " + entryc + " entries from " + otherPeerName);final long startProcess = System.currentTimeMillis();@@ -161,13 +171,12 @@ public final class transferRWI {sb.getLog().logInfo("Received " + received + " Words [" + wordhashes[0] + " .. " + wordhashes[received - 1] + "]/" + avdist + " from " + otherPeerName + ", processed in " + (System.currentTimeMillis() - startProcess) + " milliseconds, requesting " + unknownURL.size() + " URLs");}result = "ok";- } else {- sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". Not granted.");- result = "error_not_granted";+ pause = (sb.wordIndex.kSize() < 500) ? 0 : 60 * sb.wordIndex.kSize(); // estimation of necessary pause time}prop.put("unknownURL", unknownURLs.toString());prop.put("result", result);+ prop.put("pause", Integer.toString(pause));// return rewrite propertiesreturn prop;