From e0e7f86f82654b49028d9a08a64a17e419d6702c Mon Sep 17 00:00:00 2001 From: orbiter Date: Thu, 5 Jun 2008 12:52:27 +0000 Subject: [PATCH] some bugfixes for the peer-ping process git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4885 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/yacy/hello.java | 9 ++++++--- htroot/yacy/query.java | 10 +++++++--- source/de/anomic/plasma/plasmaSwitchboard.java | 2 +- source/de/anomic/yacy/yacyClient.java | 5 +++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.java index 3bb13d927..e1ee1f0cd 100644 --- a/htroot/yacy/hello.java +++ b/htroot/yacy/hello.java @@ -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 diff --git a/htroot/yacy/query.java b/htroot/yacy/query.java index ecb699705..c07e23b33 100644 --- a/htroot/yacy/query.java +++ b/htroot/yacy/query.java @@ -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()) && diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java index 9120cbc96..d2d75a10b 100644 --- a/source/de/anomic/plasma/plasmaSwitchboard.java +++ b/source/de/anomic/plasma/plasmaSwitchboard.java @@ -2706,7 +2706,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch