Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5844 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Apr 20, 2009
1 parent 1b8d346 commit dfb96ec
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
4 changes: 3 additions & 1 deletion htroot/yacy/hello.java
Expand Up @@ -49,10 +49,11 @@ public final class hello {

// example:
// http://localhost:8080/yacy/hello.html?count=1&seed=p|{Hash=sCJ6Tq8T0N9x,IPType=∅,Port=8080,IP=,Uptime=8,rI=190,Version=0.10004882,PeerType=junior,UTC=+0200,RCount=0,sI=0,LastSeen=20080605103333,Name=intratest,CCount=5.0,SCount=40,news=,USpeed=0,CRTCnt=0,CRWCnt=0,BDate=20080605081349,rU=190,LCount=187,dct=1212668923654,ICount=2,sU=0,ISpeed=0,RSpeed=0.0,NCount=0,Flags=oooo}

// http://localhost:8080/yacy/hello.html?count=10&seed=z|H4sIAAAAAAAAADWQW2vDMAyF_81eJork3GyGX-YxGigly2WFvZTQijbQJsHx1pWx_z7nMj1J4ug7B_2s6-GsP5q3G-G6vBz2e0iz8t6zfuBr7-5PUNanQfulhqyzTkuUCFXvmitrBJtq4ed3tkPTtRpXhIiRDAmq0uhHFIiQMduJ-NXYU9NCbrrP1vnjIdUqgk09uIK51V6rMBRIilAo2NajwzfhGcx8QUKsEIp5iCJo-eaTVUXPfPQ4k5dm4pp8NzaESsLzS-14QVNIMlA-ka2m1JuZJJWIBRwPo0GIIiYp4zCSkC5GQSLiJIah0p6X_rvlS-MTbWdhkCSBIni9jA_rfP3-Ae1Oye9dAQAA
public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) throws InterruptedException {
final plasmaSwitchboard sb = (plasmaSwitchboard) env;
final serverObjects prop = new serverObjects();
long start = System.currentTimeMillis();
prop.put("message", "none");
if ((post == null) || (env == null)) {
prop.put("message", "no post or no enviroment");
Expand Down Expand Up @@ -217,6 +218,7 @@ public static serverObjects respond(final httpRequestHeader header, final server
prop.put("seedlist", seeds.toString());
// return rewrite properties
prop.put("message", "ok " + seed.length());
yacyCore.log.logInfo("hello: responded remote peer '" + remoteSeed.getName() + "' [" + reportedip + "] in " + (System.currentTimeMillis() - start) + " milliseconds");
return prop;
}

Expand Down
1 change: 1 addition & 0 deletions source/de/anomic/kelondro/index/RowSet.java
Expand Up @@ -77,6 +77,7 @@ public static RowSet importRowSet(final DataInput is, final Row rowdef) throws I
}

public static RowSet importRowSet(byte[] b, final Row rowdef) {
assert b.length >= 14 : "b.length = " + b.length;
final int size = (int) NaturalOrder.decodeLong(b, 0, 4);
final int orderbound = (int) NaturalOrder.decodeLong(b, 10, 4);
final byte[] chunkcache = new byte[size * rowdef.objectsize];
Expand Down
8 changes: 4 additions & 4 deletions source/de/anomic/kelondro/text/ReferenceContainer.java
Expand Up @@ -54,14 +54,14 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSet

public ReferenceContainer(final ReferenceFactory<ReferenceType> factory, final byte[] termHash, final RowSet collection) {
super(collection);
assert termHash == null || termHash[2] != '@';
assert termHash == null || (termHash[2] != '@' && termHash.length == this.rowdef.primaryKeyLength);
this.factory = factory;
this.termHash = termHash;
}

public ReferenceContainer(final ReferenceFactory<ReferenceType> factory, final byte[] termHash, final Row rowdef, final int objectCount) {
super(rowdef, objectCount);
assert termHash == null || termHash[2] != '@';
assert termHash == null || (termHash[2] != '@' && termHash.length == this.rowdef.primaryKeyLength);
this.termHash = termHash;
this.factory = factory;
this.lastTimeWrote = 0;
Expand All @@ -74,12 +74,12 @@ public ReferenceContainer<ReferenceType> topLevelClone() {
}

public static <ReferenceType extends Reference> ReferenceContainer<ReferenceType> emptyContainer(final ReferenceFactory<ReferenceType> factory, final byte[] termHash, final int elementCount) {
assert termHash == null || termHash[2] != '@';
assert termHash == null || (termHash[2] != '@' && termHash.length == WordReferenceRow.urlEntryRow.primaryKeyLength);
return new ReferenceContainer<ReferenceType>(factory, termHash, WordReferenceRow.urlEntryRow, elementCount);
}

public void setWordHash(final byte[] newTermHash) {
assert termHash == null || termHash[2] != '@';
assert termHash == null || (termHash[2] != '@' && termHash.length == this.rowdef.primaryKeyLength);
this.termHash = newTermHash;
}

Expand Down
Expand Up @@ -320,7 +320,7 @@ public class heapCacheIterator implements CloneableIterator<ReferenceContainer<R

public heapCacheIterator(byte[] startWordHash, final boolean rot) {
this.rot = rot;
if (startWordHash.length == 0) startWordHash = null;
if (startWordHash != null && startWordHash.length == 0) startWordHash = null;
this.iterator = (startWordHash == null) ? cache.values().iterator() : cache.tailMap(startWordHash).values().iterator();
// The collection's iterator will return the values in the order that their corresponding keys appear in the tree.
}
Expand Down
11 changes: 6 additions & 5 deletions source/de/anomic/yacy/dht/Dispatcher.java
Expand Up @@ -266,15 +266,16 @@ private void enqueueContainersToCloud(final ArrayList<ReferenceContainer<WordRef
// the 'new' primary target is the word hash of the last container
lastContainer = containers[vertical].get(containers[vertical].size() - 1);
primaryTarget = FlatWordPartitionScheme.positionToHash(this.seeds.scheme.dhtPosition(lastContainer.getTermHash(), vertical));

assert primaryTarget[2] != '@';

// get or make a entry object
entry = this.transmissionCloud.get(primaryTarget); // if this is not null, the entry is extended here
ArrayList<yacySeed> targets = PeerSelection.getAcceptRemoteIndexSeedsList(
seeds,
primaryTarget,
seeds.redundancy() * 3,
true);
this.log.logInfo("enqueueContainers: selected " + targets.size() + " targets for primary target key " + primaryTarget + "/" + vertical + " with " + containers[vertical].size() + " index containers.");
this.log.logInfo("enqueueContainers: selected " + targets.size() + " targets for primary target key " + new String(primaryTarget) + "/" + vertical + " with " + containers[vertical].size() + " index containers.");
if (entry == null) entry = transmission.newChunk(primaryTarget, targets, lastContainer.row());

// fill the entry with the containers
Expand Down Expand Up @@ -353,11 +354,11 @@ public Transmission.Chunk storeDocumentIndex(Transmission.Chunk chunk) {

if (success && chunk.isFinished()) {
// finished with this queue!
this.log.logInfo("STORE: Chunk " + chunk.primaryTarget() + " has FINISHED all transmissions!");
this.log.logInfo("STORE: Chunk " + new String(chunk.primaryTarget()) + " has FINISHED all transmissions!");
return chunk;
}

this.log.logInfo("STORE: Chunk " + chunk.primaryTarget() + " has failed to transmit index; marked peer as busy");
this.log.logInfo("STORE: Chunk " + new String(chunk.primaryTarget()) + " has failed to transmit index; marked peer as busy");

if (chunk.canFinish()) {
try {
Expand All @@ -368,7 +369,7 @@ public Transmission.Chunk storeDocumentIndex(Transmission.Chunk chunk) {
}
return chunk;
} else {
this.log.logInfo("STORE: Chunk " + chunk.primaryTarget() + " has not enough targets left. This transmission has failed, putting back index to backend");
this.log.logInfo("STORE: Chunk " + new String(chunk.primaryTarget()) + " has not enough targets left. This transmission has failed, putting back index to backend");
chunk.restore();
return null;
}
Expand Down
1 change: 1 addition & 0 deletions source/de/anomic/yacy/dht/VerticalWordPartitionScheme.java
Expand Up @@ -73,6 +73,7 @@ public final long dhtPosition(final byte[] wordHash, final String urlHash) {

public final long dhtPosition(final byte[] wordHash, final int verticalPosition) {
assert wordHash != null;
assert wordHash[2] != '@';
if (partitionExponent == 0) return FlatWordPartitionScheme.std.dhtPosition(wordHash, null);
long partitionMask = (1L << (Long.SIZE - 1 - partitionExponent)) - 1L;
long verticalMask = ((long) verticalPosition) << (Long.SIZE - 1 - partitionExponent); // don't remove the cast! it will become an integer result which is wrong.
Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/yacy/yacyClient.java
Expand Up @@ -125,7 +125,7 @@ public static int publishMySeed(final yacySeed mySeed, final yacyPeerActions pee
post.add(new DefaultCharsetStringPart("seed", mySeed.genSeedStr(salt)));
// send request
final long start = System.currentTimeMillis();
final byte[] content = wput("http://" + address + "/yacy/hello.html", yacySeed.b64Hash2hexHash(otherHash) + ".yacyh", post, 15000, false);
final byte[] content = wput("http://" + address + "/yacy/hello.html", yacySeed.b64Hash2hexHash(otherHash) + ".yacyh", post, 30000, false);
yacyCore.log.logInfo("yacyClient.publishMySeed thread '" + Thread.currentThread().getName() + "' contacted peer at " + address + ", received " + ((content == null) ? "null" : content.length) + " bytes, time = " + (System.currentTimeMillis() - start) + " milliseconds");
result = FileUtils.table(content, "UTF-8");
break;
Expand All @@ -134,7 +134,7 @@ public static int publishMySeed(final yacySeed mySeed, final yacyPeerActions pee
yacyCore.log.logWarning("yacyClient.publishMySeed thread '" + Thread.currentThread().getName() + "' interrupted.");
return -1;
}
yacyCore.log.logWarning("yacyClient.publishMySeed thread '" + Thread.currentThread().getName() + "' exception: " + e.getMessage() + "; retry = " + retry);
yacyCore.log.logWarning("yacyClient.publishMySeed thread '" + Thread.currentThread().getName() + "', peer " + address + "; exception: " + e.getMessage() + "; retry = " + retry);
// try again (go into loop)
result = null;
}
Expand Down

0 comments on commit dfb96ec

Please sign in to comment.