mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
update to profile fetch behavior
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2076 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
3e31820c3d
commit
26e3216bcc
|
@ -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.<br>
|
||||
The profile can't be fetched.
|
||||
::
|
||||
The peer #[peername]# is not online.
|
||||
::
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user