diff --git a/htroot/ViewProfile.html b/htroot/ViewProfile.html index 7b82dbcda..e5624ccce 100644 --- a/htroot/ViewProfile.html +++ b/htroot/ViewProfile.html @@ -20,7 +20,8 @@ #(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.
+The profile can't be fetched. :: The peer #[peername]# is not online. :: diff --git a/htroot/ViewProfile.java b/htroot/ViewProfile.java index 4c6bfd079..3117236a5 100644 --- a/htroot/ViewProfile.java +++ b/htroot/ViewProfile.java @@ -105,26 +105,31 @@ public class ViewProfile { 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) { diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java index f683af95c..b06888339 100644 --- a/source/de/anomic/yacy/yacyClient.java +++ b/source/de/anomic/yacy/yacyClient.java @@ -1071,7 +1071,7 @@ public final class yacyClient { 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,