Skip to content

Commit

Permalink
Prevent failed DHT attemps from overwriting newer peer info
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6382 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
hermens committed Oct 8, 2009
1 parent 9324b5b commit aeab8c7
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions source/de/anomic/yacy/dht/Transmission.java
Expand Up @@ -223,9 +223,20 @@ public boolean transmit() {
}
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;
}

Expand Down

0 comments on commit aeab8c7

Please sign in to comment.