Skip to content

Commit

Permalink
update to profile fetch behavior
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2076 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed May 10, 2006
1 parent 3e31820 commit 26e3216
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
3 changes: 2 additions & 1 deletion htroot/ViewProfile.html
Expand Up @@ -20,7 +20,8 @@ <h2>Remote Peer Profile:</h2>
#(success)#
Wrong access of this page
::
The requested peer is not known or a potential peer, what means the peer's profile can't be fetched, because he is behind a firewall.
The requested peer is unknown or a potential peer.<br>
The profile can't be fetched.
::
The peer #[peername]# is not online.
::
Expand Down
27 changes: 16 additions & 11 deletions htroot/ViewProfile.java
Expand Up @@ -105,26 +105,31 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
yacySeed seed = yacyCore.seedDB.getConnected(hash);
if (seed == null) {
seed = yacyCore.seedDB.getDisconnected(hash);
if (seed == null) {
prop.put("success", "1"); // peer unknown
} else {
prop.put("success", "2"); // peer known, but disconnected
prop.put("success_peername", seed.getName());
}
long lastseen = Math.abs((System.currentTimeMillis() - seed.getLastSeenTime()) / 1000 / 60);
if (lastseen > 120) seed = null; // if contact is too old, we treat it as disconnected
}
if (seed == null) {
prop.put("success", "1"); // peer unknown
} else {
prop.put("success", "3"); // everything ok
// process news if existent
try {
yacyNewsRecord record = yacyCore.newsPool.getByOriginator(yacyNewsPool.INCOMING_DB, "prfleupd", seed.hash);
if (record != null) yacyCore.newsPool.moveOff(yacyNewsPool.INCOMING_DB, record.id());
} catch (IOException e) {}

// read profile from other peer
// try to get the profile from remote peer
profile = yacyClient.getProfile(seed);
yacyCore.log.logInfo("fetched profile:" + profile);

// if profile did not arrive, say that peer is disconnected
if (profile == null) {
prop.put("success", "2"); // peer known, but disconnected
} else {
yacyCore.log.logInfo("fetched profile:" + profile);
prop.put("success", "3"); // everything ok
}
prop.put("success_peername", seed.getName());
}
prop.put("localremotepeer", 1);
prop.put("success_peername", seed.getName());
}
Iterator i;
if (profile != null) {
Expand Down
2 changes: 1 addition & 1 deletion source/de/anomic/yacy/yacyClient.java
Expand Up @@ -1071,7 +1071,7 @@ public static HashMap getProfile(yacySeed targetSeed) {
final ArrayList v = httpc.wput(
new URL("http://" + address + "/yacy/profile.html"),
yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
20000,
10000,
null,
null,
(useProxy)?yacyCore.seedDB.sb.remoteProxyConfig:null,
Expand Down

0 comments on commit 26e3216

Please sign in to comment.