diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.java index e7b879580..29f2788cc 100644 --- a/htroot/yacy/transferRWI.java +++ b/htroot/yacy/transferRWI.java @@ -77,8 +77,10 @@ public final class transferRWI { final int wordc = Integer.parseInt(post.get("wordc", "")); // number of different words final int entryc = Integer.parseInt(post.get("entryc", "")); // number of entries in indexes byte[] indexes = post.get("indexes", "").getBytes(); // the indexes, as list of word entries - final boolean granted = sb.getConfig("allowReceiveIndex", "false").equals("true"); + boolean 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 + // response values String result = ""; StringBuffer unknownURLs = new StringBuffer(); diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java index ad972c37b..7afa347b2 100644 --- a/source/de/anomic/yacy/yacyClient.java +++ b/source/de/anomic/yacy/yacyClient.java @@ -897,7 +897,11 @@ public final class yacyClient { if (in == null) { return "no_connection_1"; } String result = (String) in.get("result"); if (result == null) { return "no_result_1"; } - if (!(result.equals("ok"))) return result; + if (!(result.equals("ok"))) { + targetSeed.setFlagAcceptRemoteIndex(false); + yacyCore.seedDB.update(targetSeed.hash, targetSeed); + return result; + } // in now contains a list of unknown hashes final String uhss = (String) in.get("unknownURL"); @@ -920,7 +924,11 @@ public final class yacyClient { if (in == null) { return "no_connection_2"; } result = (String) in.get("result"); if (result == null) { return "no_result_2"; } - if (!(result.equals("ok"))) { return result; } + if (!(result.equals("ok"))) { + targetSeed.setFlagAcceptRemoteIndex(false); + yacyCore.seedDB.update(targetSeed.hash, targetSeed); + return result; + } // int doubleentries = Integer.parseInt((String) in.get("double")); // System.out.println("DEBUG tansferIndex: transferred " + uhs.length + " URL's, double=" + doubleentries); diff --git a/source/de/anomic/yacy/yacySeedDB.java b/source/de/anomic/yacy/yacySeedDB.java index 90731c04a..e4abb25d0 100644 --- a/source/de/anomic/yacy/yacySeedDB.java +++ b/source/de/anomic/yacy/yacySeedDB.java @@ -478,6 +478,22 @@ public final class yacySeedDB { return seed; } + public void update(String hash, yacySeed seed) { + if ((mySeed != null) && (hash.equals(mySeed.hash))) { + mySeed = seed; + return; + } + + yacySeed s = get(hash, seedActiveDB); + if (s != null) try { seedActiveDB.set(hash, seed.getMap()); return;} catch (IOException e) {} + + s = get(hash, seedPassiveDB); + if (s != null) try { seedPassiveDB.set(hash, seed.getMap()); return;} catch (IOException e) {} + + s = get(hash, seedPotentialDB); + if (s != null) try { seedPotentialDB.set(hash, seed.getMap()); return;} catch (IOException e) {} + } + public yacySeed lookupByName(String peerName) { // reads a seed by searching by name