Skip to content

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

fix DHT url receive see http://bugs.yacy.net/view.php?id=242

regerc03f75ebc340
diff --git a/htroot/yacy/transferURL.java b/htroot/yacy/transferURL.java
index 0213824df..2647de94f 100644
--- a/htroot/yacy/transferURL.java
+++ b/htroot/yacy/transferURL.java
@@ -125,9 +125,9 @@ public final class transferURL {
continue;
}
- // check if the entry is blacklisted
+ // check if the entry is blacklisted
if ((blockBlacklist) && (Switchboard.urlBlacklist.isListed(BlacklistType.DHT, lEntry))) {
- if (Network.log.isFine()) Network.log.logFine("transferURL: blocked blacklisted URL '" + lEntry.url().toNormalform(false) + "' from peer " + otherPeerName);
+ if (Network.log.isFine()) Network.log.logFine("transferURL: blocked blacklisted URL '" + lEntry.url().toNormalform(false) + "' from peer " + otherPeerName);
lEntry = null;
blocked++;
continue;
@@ -145,20 +145,22 @@ public final class transferURL {
lEm.put(ASCII.String(lEntry.hash()), lEntry);
}
- Set<String> nondoubles = sb.index.exists(lEm.keySet());
- doublecheck += (lEm.size() - nondoubles.size());
- for (String id: nondoubles) {
- lEntry = lEm.get(id);
-
- // write entry to database
- if (Network.log.isFine()) Network.log.logFine("Accepting URL from peer " + otherPeerName + ": " + lEntry.url().toNormalform(true));
- try {
- sb.index.fulltext().putMetadataLater(lEntry);
- ResultURLs.stack(ASCII.String(lEntry.url().hash()), lEntry.url().getHost(), iam.getBytes(), iam.getBytes(), EventOrigin.DHT_TRANSFER);
- if (Network.log.isFine()) Network.log.logFine("transferURL: received URL '" + lEntry.url().toNormalform(false) + "' from peer " + otherPeerName);
- received++;
- } catch (final IOException e) {
- Log.logException(e);
+ Set<String> doubles = sb.index.exists(lEm.keySet());
+ doublecheck = doubles.size();
+ for (String id : lEm.keySet()) {
+ if (!doubles.contains(id)) {
+ lEntry = lEm.get(id);
+
+ // write entry to database
+ if (Network.log.isFine()) Network.log.logFine("Accepting URL from peer " + otherPeerName + ": " + lEntry.url().toNormalform(true));
+ try {
+ sb.index.fulltext().putMetadataLater(lEntry);
+ ResultURLs.stack(ASCII.String(lEntry.url().hash()), lEntry.url().getHost(), iam.getBytes(), iam.getBytes(), EventOrigin.DHT_TRANSFER);
+ if (Network.log.isFine()) Network.log.logFine("transferURL: received URL '" + lEntry.url().toNormalform(false) + "' from peer " + otherPeerName);
+ received++;
+ } catch (final IOException e) {
+ Log.logException(e);
+ }
}
}