some bugfixes for the peer-ping process

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4885 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
orbiter 2008-06-05 12:52:27 +00:00
parent cbe722c480
commit e0e7f86f82
4 changed files with 17 additions and 9 deletions

View File

@ -65,6 +65,9 @@ import de.anomic.yacy.yacyVersion;
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}
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch<?> env) throws InterruptedException {
plasmaSwitchboard sb = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects();
@ -98,8 +101,7 @@ public final class hello {
return prop;
}
final yacySeed remoteSeed = yacySeed.genRemoteSeed(seed, key, true);
remoteSeed.setIP(ias.toString());
// System.out.println("YACYHELLO: REMOTESEED=" + ((remoteSeed == null) ? "NULL" : remoteSeed.toString()));
if ((remoteSeed == null) || (remoteSeed.hash == null)) {
prop.put("message", "cannot parse your seed");
@ -136,7 +138,8 @@ public final class hello {
remoteSeed.setIP(reportedip);
urls = yacyClient.queryUrlCount(remoteSeed);
} else {
prop.put("yourip", "unknown");
prop.put("yourip", (ias == null) ? "" : ias.getHostAddress());
remoteSeed.setIP((ias == null) ? "" : ias.getHostAddress());
}
// if the previous attempt (using the reported ip address) was not successful, try the ip where

View File

@ -55,15 +55,19 @@ import de.anomic.yacy.yacyNetwork;
public final class query {
// example:
// http://localhost:8080/yacy/query.html?youare=sCJ6Tq8T0N9x&object=lurlcount
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch<?> ss) {
if (post == null || ss == null) { return null; }
// return variable that accumulates replacements
final plasmaSwitchboard sb = (plasmaSwitchboard) ss;
final serverObjects prop = new serverObjects();
if ((post == null) || (ss == null)) return prop;
if (!yacyNetwork.authentifyRequest(post, ss)) return prop;
if ((post == null) || (ss == null) || !yacyNetwork.authentifyRequest(post, ss)) {
prop.put("response", "-1"); // request rejected
return prop;
}
if ((sb.isRobinsonMode()) &&
(!sb.isPublicRobinson()) &&

View File

@ -2706,7 +2706,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
yacyCore.log.logInfo("BOOTSTRAP: seed-list URL " + seedListFileURL + " too old (" + (header.age() / 86400000) + " days)");
} else {
ssc++;
final byte[] content = HttpClient.wget(url.toString(), reqHeader, null, (int) getConfigLong("bootstrapLoadTimeout", 6000));
final byte[] content = HttpClient.wget(url.toString(), reqHeader, null, (int) getConfigLong("bootstrapLoadTimeout", 20000));
seedList = nxTools.strings(content, "UTF-8");
enu = seedList.iterator();
lc = 0;

View File

@ -117,9 +117,10 @@ public final class yacyClient {
// generate request
post.add(new StringPart("count", "20"));
post.add(new StringPart("seed", mySeed.genSeedStr(salt)));
yacyCore.log.logFine("yacyClient.publishMySeed thread '" + Thread.currentThread().getName() + "' contacting peer at " + address);
// send request
byte[] content = wput("http://" + address + "/yacy/hello.html", yacySeed.b64Hash2hexHash(otherHash) + ".yacyh", post, 10000, false);
long start = System.currentTimeMillis();
byte[] content = wput("http://" + address + "/yacy/hello.html", yacySeed.b64Hash2hexHash(otherHash) + ".yacyh", post, 15000, 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 = nxTools.table(content, "UTF-8");
break;
} catch (Exception e) {