Skip to content

Commit

Permalink
first fixes to the DHT transmission process
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5588 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Feb 10, 2009
1 parent de610b9 commit 6a876ec
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 261 deletions.
4 changes: 2 additions & 2 deletions htroot/rct_p.java
Expand Up @@ -39,9 +39,9 @@
import de.anomic.xml.RSSFeed;
import de.anomic.xml.RSSMessage;
import de.anomic.yacy.yacyClient;
import de.anomic.yacy.yacyPeerSelection;
import de.anomic.yacy.yacySeed;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.dht.PeerSelection;

public class rct_p {

Expand Down Expand Up @@ -116,7 +116,7 @@ private static void listHosts(final plasmaSwitchboard sb, final serverObjects pr
yacySeed seed;
int hc = 0;
if (sb.webIndex.seedDB != null && sb.webIndex.seedDB.sizeConnected() > 0) {
final Iterator<yacySeed> e = yacyPeerSelection.getProvidesRemoteCrawlURLs(sb.webIndex.seedDB);
final Iterator<yacySeed> e = PeerSelection.getProvidesRemoteCrawlURLs(sb.webIndex.seedDB);
while (e.hasNext()) {
seed = e.next();
if (seed != null) {
Expand Down
4 changes: 2 additions & 2 deletions htroot/yacy/hello.java
Expand Up @@ -41,9 +41,9 @@
import de.anomic.yacy.yacyClient;
import de.anomic.yacy.yacyCore;
import de.anomic.yacy.yacyNetwork;
import de.anomic.yacy.yacyPeerSelection;
import de.anomic.yacy.yacySeed;
import de.anomic.yacy.yacyVersion;
import de.anomic.yacy.dht.PeerSelection;

public final class hello {

Expand Down Expand Up @@ -184,7 +184,7 @@ public static serverObjects respond(final httpRequestHeader header, final server
if (count > 100) { count = 100; }

// latest seeds
final Map<String, yacySeed> ySeeds = yacyPeerSelection.seedsByAge(sb.webIndex.seedDB, true, count); // peerhash/yacySeed relation
final Map<String, yacySeed> ySeeds = PeerSelection.seedsByAge(sb.webIndex.seedDB, true, count); // peerhash/yacySeed relation

// attach also my own seed
seeds.append("seed0=").append(sb.webIndex.seedDB.mySeed().genSeedStr(key)).append(serverCore.CRLF_STRING);
Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/crawler/CrawlQueues.java
Expand Up @@ -47,9 +47,9 @@
import de.anomic.xml.RSSFeed;
import de.anomic.xml.RSSMessage;
import de.anomic.yacy.yacyClient;
import de.anomic.yacy.yacyPeerSelection;
import de.anomic.yacy.yacySeed;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.dht.PeerSelection;

public class CrawlQueues {

Expand Down Expand Up @@ -335,7 +335,7 @@ public boolean remoteCrawlLoaderJob() {
yacySeed seed;
if (remoteCrawlProviderHashes.size() == 0) {
if (sb.webIndex.seedDB != null && sb.webIndex.seedDB.sizeConnected() > 0) {
final Iterator<yacySeed> e = yacyPeerSelection.getProvidesRemoteCrawlURLs(sb.webIndex.seedDB);
final Iterator<yacySeed> e = PeerSelection.getProvidesRemoteCrawlURLs(sb.webIndex.seedDB);
while (e.hasNext()) {
seed = e.next();
if (seed != null) {
Expand Down
1 change: 1 addition & 0 deletions source/de/anomic/index/indexRAMRI.java
Expand Up @@ -138,6 +138,7 @@ public int getMaxWordCount() {
}

public int size() {
if (heap == null) return 0;
return heap.size();
}

Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/plasma/plasmaSearchAPI.java
Expand Up @@ -39,9 +39,9 @@
import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.order.DateFormatter;
import de.anomic.server.serverObjects;
import de.anomic.yacy.yacyPeerSelection;
import de.anomic.yacy.yacySeed;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.dht.PeerSelection;

public class plasmaSearchAPI {
// collection of static methods for a search servlet. Exists only to prevent that the same processes are defined more than once.
Expand Down Expand Up @@ -73,7 +73,7 @@ public static void listHosts(final serverObjects prop, final String startHash, f
yacySeed seed;
int hc = 0;
prop.put("searchresult_keyhash", startHash);
final Iterator<yacySeed> e = yacyPeerSelection.getAcceptRemoteIndexSeeds(sb.webIndex.seedDB, startHash, sb.webIndex.seedDB.sizeConnected(), true);
final Iterator<yacySeed> e = PeerSelection.getAcceptRemoteIndexSeeds(sb.webIndex.seedDB, startHash, sb.webIndex.seedDB.sizeConnected(), true);
while (e.hasNext()) {
seed = e.next();
if (seed != null) {
Expand Down
6 changes: 4 additions & 2 deletions source/de/anomic/yacy/dht/Transmission.java
Expand Up @@ -194,7 +194,7 @@ public boolean transmit() {
log.logInfo("Transfer of chunk to myself-target");
return true;
}
log.logInfo("starting new index transmission thread " + this.primaryTarget);
log.logInfo("starting new index transmission request to " + this.primaryTarget);
long start = System.currentTimeMillis();
final HashMap<String, Object> ohm = yacyClient.transferIndex(target, this.containers, this.references, gzipBody4Transfer, timeout4Transfer);
final String result = (String) ohm.get("result");
Expand All @@ -219,7 +219,9 @@ public boolean transmit() {
return true;
}
this.miss++;
seeds.peerActions.peerDeparture(target, "did not accept index");
// 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());
return false;
}
Expand Down
5 changes: 3 additions & 2 deletions source/de/anomic/yacy/yacyCore.java
Expand Up @@ -58,6 +58,7 @@
import de.anomic.server.serverSemaphore;
import de.anomic.xml.RSSFeed;
import de.anomic.xml.RSSMessage;
import de.anomic.yacy.dht.PeerSelection;

public class yacyCore {

Expand Down Expand Up @@ -305,7 +306,7 @@ private int publishMySeed(final boolean force) {
if (sb.webIndex.seedDB.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN).equals(yacySeed.PEERTYPE_VIRGIN)) {
if (attempts > PING_INITIAL) { attempts = PING_INITIAL; }
final Map<String, String> ch = plasmaSwitchboard.getSwitchboard().clusterhashes;
seeds = yacyPeerSelection.seedsByAge(sb.webIndex.seedDB, true, attempts - ((ch == null) ? 0 : ch.size())); // best for fast connection
seeds = PeerSelection.seedsByAge(sb.webIndex.seedDB, true, attempts - ((ch == null) ? 0 : ch.size())); // best for fast connection
// add also all peers from cluster if this is a public robinson cluster
if (ch != null) {
final Iterator<Map.Entry<String, String>> i = ch.entrySet().iterator();
Expand All @@ -332,7 +333,7 @@ private int publishMySeed(final boolean force) {
} else {
if (attempts > PING_MIN_RUNNING) { attempts = PING_MIN_RUNNING; }
}
seeds = yacyPeerSelection.seedsByAge(sb.webIndex.seedDB, false, attempts); // best for seed list maintenance/cleaning
seeds = PeerSelection.seedsByAge(sb.webIndex.seedDB, false, attempts); // best for seed list maintenance/cleaning
}

if ((seeds == null) || seeds.size() == 0) { return 0; }
Expand Down
249 changes: 0 additions & 249 deletions source/de/anomic/yacy/yacyPeerSelection.java

This file was deleted.

0 comments on commit 6a876ec

Please sign in to comment.