git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5844 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 1b8d346b4c
commit dfb96ecb72

@ -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");
@ -217,6 +218,7 @@ public final class hello {
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;
}

@ -77,6 +77,7 @@ public class RowSet extends RowCollection implements ObjectIndex, Iterable<Row.E
}
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];

@ -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;
@ -74,12 +74,12 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSet
}
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;
}

@ -320,7 +320,7 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> exte
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.
}

@ -266,7 +266,8 @@ public class Dispatcher {
// 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(
@ -274,7 +275,7 @@ public class Dispatcher {
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
@ -353,11 +354,11 @@ public class Dispatcher {
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 {
@ -368,7 +369,7 @@ public class Dispatcher {
}
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;
}

@ -73,6 +73,7 @@ public class VerticalWordPartitionScheme implements PartitionScheme {
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.

@ -125,7 +125,7 @@ public final class yacyClient {
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;
@ -134,7 +134,7 @@ public final class yacyClient {
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;
}

Loading…
Cancel
Save