mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
- fixed/enhanced move to SD/16:9 images (network, web structure)
- added logging in peer ping to analyse time-consuming elements which could be cause for disappearing peers git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7450 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
0376f73fdb
commit
28f669bf0b
|
@ -206,7 +206,7 @@ public class Network {
|
|||
yacySeed peer = new yacySeed(post.get("peerHash"), map);
|
||||
|
||||
sb.updateMySeed();
|
||||
final int added = yacyClient.publishMySeed(sb.peers.mySeed(), sb.peers.peerActions, peer.getPublicAddress(), peer.hash);
|
||||
final int added = yacyClient.hello(sb.peers.mySeed(), sb.peers.peerActions, peer.getPublicAddress(), peer.hash);
|
||||
|
||||
if (added <= 0) {
|
||||
prop.put("table_comment",1);
|
||||
|
|
|
@ -90,7 +90,7 @@ public class NetworkPicture {
|
|||
if (height < 240) height = 240;
|
||||
if (height > 1080) height = 1080;
|
||||
if (!authorized) {
|
||||
width = Math.min(768, width);
|
||||
width = Math.min(1024, width);
|
||||
height = Math.min(576, height);
|
||||
}
|
||||
if (passiveLimit > 1000000) passiveLimit = 1000000;
|
||||
|
|
|
@ -24,7 +24,7 @@ public class WatchWebStructure_p {
|
|||
String color_line = "222222";
|
||||
String color_lineend = "333333";
|
||||
|
||||
int width = 768;
|
||||
int width = 1024;
|
||||
int height = 576;
|
||||
int depth = 3;
|
||||
int nodes = 500; // maximum number of host nodes that are painted
|
||||
|
@ -33,10 +33,10 @@ public class WatchWebStructure_p {
|
|||
String besthost;
|
||||
|
||||
if (post != null) {
|
||||
width = post.getInt("width", 768);
|
||||
width = post.getInt("width", 1024);
|
||||
height = post.getInt("height", 576);
|
||||
depth = post.getInt("depth", 3);
|
||||
nodes = post.getInt("nodes", width * height * 100 / 768 / 576);
|
||||
nodes = post.getInt("nodes", width * height * 100 / 1024 / 576);
|
||||
time = post.getInt("time", -1);
|
||||
host = post.get("host", "auto");
|
||||
color_text = post.get("colortext", color_text);
|
||||
|
|
|
@ -57,7 +57,7 @@ public class WebStructurePicture_p {
|
|||
String color_line = "222222";
|
||||
String color_lineend = "333333";
|
||||
|
||||
int width = 768;
|
||||
int width = 1024;
|
||||
int height = 576;
|
||||
int depth = 3;
|
||||
int nodes = 100; // maximum number of host nodes that are painted
|
||||
|
@ -65,10 +65,10 @@ public class WebStructurePicture_p {
|
|||
String host = null;
|
||||
|
||||
if (post != null) {
|
||||
width = post.getInt("width", 768);
|
||||
width = post.getInt("width", 1024);
|
||||
height = post.getInt("height", 576);
|
||||
depth = post.getInt("depth", 3);
|
||||
nodes = post.getInt("nodes", width * height * 100 / 768 / 576);
|
||||
nodes = post.getInt("nodes", width * height * 100 / 1024 / 576);
|
||||
time = post.getInt("time", -1);
|
||||
host = post.get("host", null);
|
||||
color_text = post.get("colortext", color_text);
|
||||
|
|
|
@ -77,13 +77,16 @@ public final class hello {
|
|||
try {count = (countStr == null) ? 0 : Integer.parseInt(countStr);} catch (final NumberFormatException e) {count = 0;}
|
||||
// final Date remoteTime = yacyCore.parseUniversalDate(post.get(MYTIME)); // read remote time
|
||||
final String clientip = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "<unknown>"); // read an artificial header addendum
|
||||
long time = System.currentTimeMillis();
|
||||
final InetAddress ias = Domains.dnsResolve(clientip);
|
||||
long time_dnsResolve = System.currentTimeMillis() - time;
|
||||
if (ias == null) {
|
||||
yacyCore.log.logInfo("hello/server: failed contacting seed; clientip not resolvable (clientip=" + clientip + ", time_dnsResolve=" + time_dnsResolve + ")");
|
||||
prop.put("message", "cannot resolve your IP from your reported location " + clientip);
|
||||
return prop;
|
||||
}
|
||||
if (seed.length() > yacySeed.maxsize) {
|
||||
yacyCore.log.logInfo("hello/server: rejected contacting seed; too large (" + seed.length() + " > " + yacySeed.maxsize + ")");
|
||||
yacyCore.log.logInfo("hello/server: rejected contacting seed; too large (" + seed.length() + " > " + yacySeed.maxsize + ", time_dnsResolve=" + time_dnsResolve + ")");
|
||||
prop.put("message", "your seed is too long (" + seed.length() + ")");
|
||||
return prop;
|
||||
}
|
||||
|
@ -91,13 +94,13 @@ public final class hello {
|
|||
try {
|
||||
remoteSeed = yacySeed.genRemoteSeed(seed, key, true);
|
||||
} catch (IOException e) {
|
||||
yacyCore.log.logInfo("hello/server: bad seed: " + e.getMessage());
|
||||
yacyCore.log.logInfo("hello/server: bad seed: " + e.getMessage() + ", time_dnsResolve=" + time_dnsResolve);
|
||||
prop.put("message", "bad seed: " + e.getMessage());
|
||||
return prop;
|
||||
}
|
||||
|
||||
// System.out.println("YACYHELLO: REMOTESEED=" + ((remoteSeed == null) ? "NULL" : remoteSeed.toString()));
|
||||
if (remoteSeed == null || remoteSeed.hash == null) {
|
||||
yacyCore.log.logInfo("hello/server: bad seed: null, time_dnsResolve=" + time_dnsResolve);
|
||||
prop.put("message", "cannot parse your seed");
|
||||
return prop;
|
||||
}
|
||||
|
@ -124,6 +127,9 @@ public final class hello {
|
|||
// if the remote client has reported its own IP address and the client supports
|
||||
// the port forwarding feature (if client version >= 0.383) then we try to
|
||||
// connect to the reported IP address first
|
||||
time = System.currentTimeMillis();
|
||||
long time_backping = 0;
|
||||
String backping_method = "none";
|
||||
if (reportedip.length() > 0 && !clientip.equals(reportedip) && clientversion >= yacyVersion.YACY_SUPPORTS_PORT_FORWARDING) {
|
||||
serverCore.checkInterruption();
|
||||
|
||||
|
@ -131,13 +137,15 @@ public final class hello {
|
|||
prop.put("yourip", reportedip);
|
||||
remoteSeed.setIP(reportedip);
|
||||
urls = yacyClient.queryUrlCount(remoteSeed);
|
||||
time_backping = System.currentTimeMillis() - time;
|
||||
backping_method = "reportedip=" + reportedip;
|
||||
} else {
|
||||
prop.put("yourip", ias.getHostAddress());
|
||||
remoteSeed.setIP(ias.getHostAddress());
|
||||
}
|
||||
|
||||
// if the previous attempt (using the reported ip address) was not successful, try the ip where
|
||||
// the request came from
|
||||
// if the previous attempt (using the reported ip address) was not successful,
|
||||
// then try the ip where the request came from
|
||||
if (urls < 0) {
|
||||
boolean isNotLocal = true;
|
||||
|
||||
|
@ -151,6 +159,8 @@ public final class hello {
|
|||
prop.put("yourip", clientip);
|
||||
remoteSeed.setIP(clientip);
|
||||
urls = yacyClient.queryUrlCount(remoteSeed);
|
||||
time_backping = System.currentTimeMillis() - time;
|
||||
backping_method = "clientip=" + clientip;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,11 +180,12 @@ public final class hello {
|
|||
remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR);
|
||||
}
|
||||
// connect the seed
|
||||
yacyCore.log.logInfo("hello/server: responded remote senior peer '" + remoteSeed.getName() + "' from " + reportedip + ", time_dnsResolve=" + time_dnsResolve + ", time_backping=" + time_backping + ", method=" + backping_method + ", urls=" + urls);
|
||||
sb.peers.peerActions.peerArrival(remoteSeed, true);
|
||||
} else {
|
||||
prop.put(yacySeed.YOURTYPE, yacySeed.PEERTYPE_JUNIOR);
|
||||
remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR);
|
||||
yacyCore.log.logInfo("hello: responded remote junior peer '" + remoteSeed.getName() + "' from " + reportedip);
|
||||
yacyCore.log.logInfo("hello/server: responded remote junior peer '" + remoteSeed.getName() + "' from " + reportedip + ", time_dnsResolve=" + time_dnsResolve + ", time_backping=" + time_backping + ", method=" + backping_method + ", urls=" + urls);
|
||||
// no connection here, instead store junior in connection cache
|
||||
if ((remoteSeed.hash != null) && (remoteSeed.isProper(false) == null)) {
|
||||
sb.peers.peerActions.peerPing(remoteSeed);
|
||||
|
@ -182,7 +193,7 @@ public final class hello {
|
|||
}
|
||||
sb.peers.peerActions.setUserAgent(clientip, userAgent);
|
||||
if (!(prop.get(yacySeed.YOURTYPE)).equals(reportedPeerType)) {
|
||||
yacyCore.log.logInfo("hello: changing remote peer '" + remoteSeed.getName() +
|
||||
yacyCore.log.logInfo("hello/server: changing remote peer '" + remoteSeed.getName() +
|
||||
"' [" + reportedip +
|
||||
"] peerType from '" + reportedPeerType +
|
||||
"' to '" + prop.get(yacySeed.YOURTYPE) + "'.");
|
||||
|
@ -229,7 +240,7 @@ public final class hello {
|
|||
prop.put("seedlist", seeds.toString());
|
||||
// return rewrite properties
|
||||
prop.put("message", "ok " + seed.length());
|
||||
yacyCore.log.logInfo("hello: responded remote peer '" + remoteSeed.getName() + "' [" + reportedip + "] in " + (System.currentTimeMillis() - start) + " milliseconds");
|
||||
yacyCore.log.logInfo("hello/server: responded remote peer '" + remoteSeed.getName() + "' [" + reportedip + "] in " + (System.currentTimeMillis() - start) + " milliseconds");
|
||||
return prop;
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ public final class yacyClient {
|
|||
*
|
||||
* @return the number of new seeds
|
||||
*/
|
||||
public static int publishMySeed(final yacySeed mySeed, final yacyPeerActions peerActions, final String address, final String otherHash) {
|
||||
public static int hello(final yacySeed mySeed, final yacyPeerActions peerActions, final String address, final String otherHash) {
|
||||
|
||||
Map<String, String> result = null;
|
||||
final String salt = crypt.randomSalt();
|
||||
|
@ -137,20 +137,20 @@ public final class yacyClient {
|
|||
// send request
|
||||
final long start = System.currentTimeMillis();
|
||||
final byte[] content = HTTPConnector.getConnector(MultiProtocolURI.yacybotUserAgent).post(new MultiProtocolURI("http://" + address + "/yacy/hello.html"), 30000, yacySeed.b64Hash2hexHash(otherHash) + ".yacyh", parts);
|
||||
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");
|
||||
yacyCore.log.logInfo("yacyClient.hello thread '" + Thread.currentThread().getName() + "' contacted peer at " + address + ", received " + ((content == null) ? "null" : content.length) + " bytes, time = " + (System.currentTimeMillis() - start) + " milliseconds");
|
||||
result = FileUtils.table(content);
|
||||
} catch (final Exception e) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
yacyCore.log.logInfo("yacyClient.publishMySeed thread '" + Thread.currentThread().getName() + "' interrupted.");
|
||||
yacyCore.log.logInfo("yacyClient.hello thread '" + Thread.currentThread().getName() + "' interrupted.");
|
||||
return -1;
|
||||
}
|
||||
yacyCore.log.logInfo("yacyClient.publishMySeed thread '" + Thread.currentThread().getName() + "', peer " + address + "; exception: " + e.getMessage());
|
||||
yacyCore.log.logInfo("yacyClient.hello thread '" + Thread.currentThread().getName() + "', peer " + address + "; exception: " + e.getMessage());
|
||||
// try again (go into loop)
|
||||
result = null;
|
||||
}
|
||||
|
||||
if (result == null) {
|
||||
yacyCore.log.logInfo("yacyClient.publishMySeed result error: " +
|
||||
yacyCore.log.logInfo("yacyClient.hello result error: " +
|
||||
((result == null) ? "result null" : ("result=" + result.toString())));
|
||||
return -1;
|
||||
}
|
||||
|
@ -167,11 +167,11 @@ public final class yacyClient {
|
|||
try {
|
||||
otherPeer = yacySeed.genRemoteSeed(seed, salt, false);
|
||||
if (!otherPeer.hash.equals(otherHash)) {
|
||||
yacyCore.log.logInfo("yacyClient.publishMySeed: consistency error: otherPeer.hash = " + otherPeer.hash + ", otherHash = " + otherHash);
|
||||
yacyCore.log.logInfo("yacyClient.hello: consistency error: otherPeer.hash = " + otherPeer.hash + ", otherHash = " + otherHash);
|
||||
return -1; // no success
|
||||
}
|
||||
} catch (IOException e) {
|
||||
yacyCore.log.logInfo("yacyClient.publishMySeed: consistency error: other seed bad:" + e.getMessage() + ", seed=" + seed);
|
||||
yacyCore.log.logInfo("yacyClient.hello: consistency error: other seed bad:" + e.getMessage() + ", seed=" + seed);
|
||||
return -1; // no success
|
||||
}
|
||||
}
|
||||
|
@ -207,13 +207,13 @@ public final class yacyClient {
|
|||
* If this is true we try to reconnect the sch channel to the remote server now.
|
||||
*/
|
||||
if (mytype.equalsIgnoreCase(yacySeed.PEERTYPE_JUNIOR)) {
|
||||
yacyCore.log.logInfo("yacyClient.publishMySeed: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as junior.");
|
||||
yacyCore.log.logInfo("yacyClient.hello: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as junior.");
|
||||
} else if ((mytype.equalsIgnoreCase(yacySeed.PEERTYPE_SENIOR)) ||
|
||||
(mytype.equalsIgnoreCase(yacySeed.PEERTYPE_PRINCIPAL))) {
|
||||
if (yacyCore.log.isFine()) yacyCore.log.logFine("yacyClient.publishMySeed: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as " + mytype + ", accepted other peer.");
|
||||
if (yacyCore.log.isFine()) yacyCore.log.logFine("yacyClient.hello: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as " + mytype + ", accepted other peer.");
|
||||
} else {
|
||||
// wrong type report
|
||||
if (yacyCore.log.isFine()) yacyCore.log.logFine("yacyClient.publishMySeed: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as " + mytype + ", rejecting other peer.");
|
||||
if (yacyCore.log.isFine()) yacyCore.log.logFine("yacyClient.hello: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as " + mytype + ", rejecting other peer.");
|
||||
return -1;
|
||||
}
|
||||
if (mySeed.orVirgin().equals(yacySeed.PEERTYPE_VIRGIN))
|
||||
|
@ -221,7 +221,7 @@ public final class yacyClient {
|
|||
|
||||
final String error = mySeed.isProper(true);
|
||||
if (error != null) {
|
||||
yacyCore.log.logSevere("yacyClient.publishMySeed mySeed error - not proper: " + error);
|
||||
yacyCore.log.logSevere("yacyClient.hello mySeed error - not proper: " + error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ public class yacyCore {
|
|||
|
||||
public final void run() {
|
||||
try {
|
||||
this.added = yacyClient.publishMySeed(sb.peers.mySeed(), sb.peers.peerActions, seed.getClusterAddress(), seed.hash);
|
||||
this.added = yacyClient.hello(sb.peers.mySeed(), sb.peers.peerActions, seed.getClusterAddress(), seed.hash);
|
||||
if (this.added < 0) {
|
||||
// no or wrong response, delete that address
|
||||
final String cause = "peer ping to peer resulted in error response (added < 0)";
|
||||
|
|
Loading…
Reference in New Issue
Block a user