*) Bugfix for nameLookup parameter handling

*) Bugfix for Received xx Words [xxxxxxx .. null] Bug



git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@953 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 20 years ago
parent 99f4d2931a
commit 7256bea45f

@ -73,7 +73,7 @@ public final class Connections_p {
// determines if name lookup should be done or not // determines if name lookup should be done or not
boolean doNameLookup = true; boolean doNameLookup = true;
if (post.containsKey("nameLookup") && post.get("nameLookup","true").equals("false")) { if ((post != null) && post.containsKey("nameLookup") && post.get("nameLookup","true").equals("false")) {
doNameLookup = false; doNameLookup = false;
} }

@ -66,20 +66,18 @@ public final class transferRWI {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) throws InterruptedException { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) throws InterruptedException {
if (post == null || ss == null) { return null; } if (post == null || ss == null) { return null; }
long start = System.currentTimeMillis();
// return variable that accumulates replacements // return variable that accumulates replacements
final plasmaSwitchboard sb = (plasmaSwitchboard) ss; final plasmaSwitchboard sb = (plasmaSwitchboard) ss;
final serverObjects prop = new serverObjects(); final serverObjects prop = new serverObjects();
if (prop == null || sb == null) { return null; } if (prop == null || sb == null) { return null; }
// request values // request values
final String iam = (String) post.get("iam", ""); // seed hash of requester final String iam = post.get("iam", ""); // seed hash of requester
// final String youare = (String) post.get("youare", ""); // seed hash of the target peer, needed for network stability // final String youare = (String) post.get("youare", ""); // seed hash of the target peer, needed for network stability
// final String key = (String) post.get("key", ""); // transmission key // final String key = (String) post.get("key", ""); // transmission key
final int wordc = Integer.parseInt((String) post.get("wordc", "")); // number of different words final int wordc = Integer.parseInt(post.get("wordc", "")); // number of different words
final int entryc = Integer.parseInt((String) post.get("entryc", "")); // number of entries in indexes final int entryc = Integer.parseInt(post.get("entryc", "")); // number of entries in indexes
byte[] indexes = ((String) post.get("indexes", "")).getBytes(); // the indexes, as list of word entries byte[] indexes = post.get("indexes", "").getBytes(); // the indexes, as list of word entries
final boolean granted = sb.getConfig("allowReceiveIndex", "false").equals("true"); final boolean granted = sb.getConfig("allowReceiveIndex", "false").equals("true");
// response values // response values
@ -115,17 +113,18 @@ public final class transferRWI {
String wordHash; String wordHash;
String urlHash; String urlHash;
plasmaWordIndexEntry entry; plasmaWordIndexEntry entry;
int wordhashesSize = v.size();
final HashSet unknownURL = new HashSet(); final HashSet unknownURL = new HashSet();
String[] wordhashes = new String[v.size()]; String[] wordhashes = new String[v.size()];
int received = 0; int received = 0;
for (int i = 0; i < v.size(); i++) { for (int i = 0; i < wordhashesSize; i++) {
serverCore.checkInterruption(); serverCore.checkInterruption();
estring = (String) v.removeFirst(); estring = (String) v.removeFirst();
p = estring.indexOf("{"); p = estring.indexOf("{");
if (p > 0) { if (p > 0) {
wordHash = estring.substring(0, p); wordHash = estring.substring(0, p);
wordhashes[i] = wordHash; wordhashes[received] = wordHash;
entry = new plasmaWordIndexEntry(estring.substring(p)); entry = new plasmaWordIndexEntry(estring.substring(p));
sb.wordIndex.addEntries(plasmaWordIndexEntryContainer.instantContainer(wordHash, System.currentTimeMillis(), entry), true); sb.wordIndex.addEntries(plasmaWordIndexEntryContainer.instantContainer(wordHash, System.currentTimeMillis(), entry), true);
serverCore.checkInterruption(); serverCore.checkInterruption();
@ -141,7 +140,8 @@ public final class transferRWI {
yacyCore.seedDB.mySeed.incRI(received); yacyCore.seedDB.mySeed.incRI(received);
// finally compose the unknownURL hash list // finally compose the unknownURL hash list
final Iterator it = unknownURL.iterator(); final Iterator it = unknownURL.iterator();
unknownURLs.ensureCapacity(unknownURL.size()*13);
while (it.hasNext()) { while (it.hasNext()) {
unknownURLs.append(",").append((String) it.next()); unknownURLs.append(",").append((String) it.next());
} }
@ -149,8 +149,8 @@ public final class transferRWI {
if (wordhashes.length == 0) { if (wordhashes.length == 0) {
sb.getLog().logInfo("Received 0 RWIs from " + otherPeerName + ", processed in " + (System.currentTimeMillis() - startProcess) + " milliseconds, requesting " + unknownURL.size() + " URLs"); sb.getLog().logInfo("Received 0 RWIs from " + otherPeerName + ", processed in " + (System.currentTimeMillis() - startProcess) + " milliseconds, requesting " + unknownURL.size() + " URLs");
} else { } else {
final double avdist = (yacyDHTAction.dhtDistance(yacyCore.seedDB.mySeed.hash, wordhashes[0]) + yacyDHTAction.dhtDistance(yacyCore.seedDB.mySeed.hash, wordhashes[wordhashes.length - 1])) / 2.0; final double avdist = (yacyDHTAction.dhtDistance(yacyCore.seedDB.mySeed.hash, wordhashes[0]) + yacyDHTAction.dhtDistance(yacyCore.seedDB.mySeed.hash, wordhashes[received - 1])) / 2.0;
sb.getLog().logInfo("Received " + received + " Words [" + wordhashes[0] + " .. " + wordhashes[wordhashes.length - 1] + "]/" + avdist + " from " + otherPeerName + ", processed in " + (System.currentTimeMillis() - startProcess) + " milliseconds, requesting " + unknownURL.size() + " URLs"); 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"; result = "ok";
} else { } else {

Loading…
Cancel
Save