From aeab8c7917ad84f614fc380ed1c8cedea279bc78 Mon Sep 17 00:00:00 2001 From: hermens Date: Thu, 8 Oct 2009 00:17:29 +0000 Subject: [PATCH] Prevent failed DHT attemps from overwriting newer peer info git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6382 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/yacy/dht/Transmission.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/source/de/anomic/yacy/dht/Transmission.java b/source/de/anomic/yacy/dht/Transmission.java index e45041799..e1b80199d 100644 --- a/source/de/anomic/yacy/dht/Transmission.java +++ b/source/de/anomic/yacy/dht/Transmission.java @@ -223,9 +223,20 @@ public class Transmission { } this.miss++; // write information that peer does not receive index transmissions - target.setFlagAcceptRemoteIndex(false); - seeds.update(target.hash, target); log.logInfo("Transfer failed of chunk to target " + target.hash + "/" + target.getName() + ": " + error); + // get possibly newer target Info + yacySeed newTarget = seeds.get(target.hash); + if (newTarget != null) { + String oldAddress = target.getPublicAddress(); + if ((oldAddress != null) && (oldAddress.equals(newTarget.getPublicAddress()))) { + newTarget.setFlagAcceptRemoteIndex(false); + seeds.update(newTarget.hash, newTarget); + } else { + // we tried an old Address. Don't change anything + } + } else { + // target not in DB anymore. ??? + } return false; }