- 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:
orbiter 2011-01-27 10:16:14 +00:00
parent 0376f73fdb
commit 28f669bf0b
7 changed files with 39 additions and 28 deletions

View File

@ -206,7 +206,7 @@ public class Network {
yacySeed peer = new yacySeed(post.get("peerHash"), map); yacySeed peer = new yacySeed(post.get("peerHash"), map);
sb.updateMySeed(); 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) { if (added <= 0) {
prop.put("table_comment",1); prop.put("table_comment",1);

View File

@ -90,7 +90,7 @@ public class NetworkPicture {
if (height < 240) height = 240; if (height < 240) height = 240;
if (height > 1080) height = 1080; if (height > 1080) height = 1080;
if (!authorized) { if (!authorized) {
width = Math.min(768, width); width = Math.min(1024, width);
height = Math.min(576, height); height = Math.min(576, height);
} }
if (passiveLimit > 1000000) passiveLimit = 1000000; if (passiveLimit > 1000000) passiveLimit = 1000000;

View File

@ -24,7 +24,7 @@ public class WatchWebStructure_p {
String color_line = "222222"; String color_line = "222222";
String color_lineend = "333333"; String color_lineend = "333333";
int width = 768; int width = 1024;
int height = 576; int height = 576;
int depth = 3; int depth = 3;
int nodes = 500; // maximum number of host nodes that are painted int nodes = 500; // maximum number of host nodes that are painted
@ -33,10 +33,10 @@ public class WatchWebStructure_p {
String besthost; String besthost;
if (post != null) { if (post != null) {
width = post.getInt("width", 768); width = post.getInt("width", 1024);
height = post.getInt("height", 576); height = post.getInt("height", 576);
depth = post.getInt("depth", 3); 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); time = post.getInt("time", -1);
host = post.get("host", "auto"); host = post.get("host", "auto");
color_text = post.get("colortext", color_text); color_text = post.get("colortext", color_text);

View File

@ -57,7 +57,7 @@ public class WebStructurePicture_p {
String color_line = "222222"; String color_line = "222222";
String color_lineend = "333333"; String color_lineend = "333333";
int width = 768; int width = 1024;
int height = 576; int height = 576;
int depth = 3; int depth = 3;
int nodes = 100; // maximum number of host nodes that are painted int nodes = 100; // maximum number of host nodes that are painted
@ -65,10 +65,10 @@ public class WebStructurePicture_p {
String host = null; String host = null;
if (post != null) { if (post != null) {
width = post.getInt("width", 768); width = post.getInt("width", 1024);
height = post.getInt("height", 576); height = post.getInt("height", 576);
depth = post.getInt("depth", 3); 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); time = post.getInt("time", -1);
host = post.get("host", null); host = post.get("host", null);
color_text = post.get("colortext", color_text); color_text = post.get("colortext", color_text);

View File

@ -77,13 +77,16 @@ public final class hello {
try {count = (countStr == null) ? 0 : Integer.parseInt(countStr);} catch (final NumberFormatException e) {count = 0;} 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 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 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); final InetAddress ias = Domains.dnsResolve(clientip);
long time_dnsResolve = System.currentTimeMillis() - time;
if (ias == null) { 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); prop.put("message", "cannot resolve your IP from your reported location " + clientip);
return prop; return prop;
} }
if (seed.length() > yacySeed.maxsize) { 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() + ")"); prop.put("message", "your seed is too long (" + seed.length() + ")");
return prop; return prop;
} }
@ -91,13 +94,13 @@ public final class hello {
try { try {
remoteSeed = yacySeed.genRemoteSeed(seed, key, true); remoteSeed = yacySeed.genRemoteSeed(seed, key, true);
} catch (IOException e) { } 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()); prop.put("message", "bad seed: " + e.getMessage());
return prop; return prop;
} }
// System.out.println("YACYHELLO: REMOTESEED=" + ((remoteSeed == null) ? "NULL" : remoteSeed.toString()));
if (remoteSeed == null || remoteSeed.hash == null) { 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"); prop.put("message", "cannot parse your seed");
return prop; return prop;
} }
@ -124,6 +127,9 @@ public final class hello {
// if the remote client has reported its own IP address and the client supports // 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 // the port forwarding feature (if client version >= 0.383) then we try to
// connect to the reported IP address first // 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) { if (reportedip.length() > 0 && !clientip.equals(reportedip) && clientversion >= yacyVersion.YACY_SUPPORTS_PORT_FORWARDING) {
serverCore.checkInterruption(); serverCore.checkInterruption();
@ -131,13 +137,15 @@ public final class hello {
prop.put("yourip", reportedip); prop.put("yourip", reportedip);
remoteSeed.setIP(reportedip); remoteSeed.setIP(reportedip);
urls = yacyClient.queryUrlCount(remoteSeed); urls = yacyClient.queryUrlCount(remoteSeed);
time_backping = System.currentTimeMillis() - time;
backping_method = "reportedip=" + reportedip;
} else { } else {
prop.put("yourip", ias.getHostAddress()); prop.put("yourip", ias.getHostAddress());
remoteSeed.setIP(ias.getHostAddress()); remoteSeed.setIP(ias.getHostAddress());
} }
// if the previous attempt (using the reported ip address) was not successful, try the ip where // if the previous attempt (using the reported ip address) was not successful,
// the request came from // then try the ip where the request came from
if (urls < 0) { if (urls < 0) {
boolean isNotLocal = true; boolean isNotLocal = true;
@ -151,6 +159,8 @@ public final class hello {
prop.put("yourip", clientip); prop.put("yourip", clientip);
remoteSeed.setIP(clientip); remoteSeed.setIP(clientip);
urls = yacyClient.queryUrlCount(remoteSeed); 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); remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR);
} }
// connect the seed // 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); sb.peers.peerActions.peerArrival(remoteSeed, true);
} else { } else {
prop.put(yacySeed.YOURTYPE, yacySeed.PEERTYPE_JUNIOR); prop.put(yacySeed.YOURTYPE, yacySeed.PEERTYPE_JUNIOR);
remoteSeed.put(yacySeed.PEERTYPE, 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 // no connection here, instead store junior in connection cache
if ((remoteSeed.hash != null) && (remoteSeed.isProper(false) == null)) { if ((remoteSeed.hash != null) && (remoteSeed.isProper(false) == null)) {
sb.peers.peerActions.peerPing(remoteSeed); sb.peers.peerActions.peerPing(remoteSeed);
@ -182,7 +193,7 @@ public final class hello {
} }
sb.peers.peerActions.setUserAgent(clientip, userAgent); sb.peers.peerActions.setUserAgent(clientip, userAgent);
if (!(prop.get(yacySeed.YOURTYPE)).equals(reportedPeerType)) { 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 + "' [" + reportedip +
"] peerType from '" + reportedPeerType + "] peerType from '" + reportedPeerType +
"' to '" + prop.get(yacySeed.YOURTYPE) + "'."); "' to '" + prop.get(yacySeed.YOURTYPE) + "'.");
@ -229,7 +240,7 @@ public final class hello {
prop.put("seedlist", seeds.toString()); prop.put("seedlist", seeds.toString());
// return rewrite properties // return rewrite properties
prop.put("message", "ok " + seed.length()); 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; return prop;
} }

View File

@ -125,7 +125,7 @@ public final class yacyClient {
* *
* @return the number of new seeds * @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; Map<String, String> result = null;
final String salt = crypt.randomSalt(); final String salt = crypt.randomSalt();
@ -137,20 +137,20 @@ public final class yacyClient {
// send request // send request
final long start = System.currentTimeMillis(); 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); 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); result = FileUtils.table(content);
} catch (final Exception e) { } catch (final Exception e) {
if (Thread.currentThread().isInterrupted()) { 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; 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) // try again (go into loop)
result = null; result = null;
} }
if (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()))); ((result == null) ? "result null" : ("result=" + result.toString())));
return -1; return -1;
} }
@ -167,11 +167,11 @@ public final class yacyClient {
try { try {
otherPeer = yacySeed.genRemoteSeed(seed, salt, false); otherPeer = yacySeed.genRemoteSeed(seed, salt, false);
if (!otherPeer.hash.equals(otherHash)) { 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 return -1; // no success
} }
} catch (IOException e) { } 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 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 this is true we try to reconnect the sch channel to the remote server now.
*/ */
if (mytype.equalsIgnoreCase(yacySeed.PEERTYPE_JUNIOR)) { 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)) || } else if ((mytype.equalsIgnoreCase(yacySeed.PEERTYPE_SENIOR)) ||
(mytype.equalsIgnoreCase(yacySeed.PEERTYPE_PRINCIPAL))) { (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 { } else {
// wrong type report // 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; return -1;
} }
if (mySeed.orVirgin().equals(yacySeed.PEERTYPE_VIRGIN)) if (mySeed.orVirgin().equals(yacySeed.PEERTYPE_VIRGIN))
@ -221,7 +221,7 @@ public final class yacyClient {
final String error = mySeed.isProper(true); final String error = mySeed.isProper(true);
if (error != null) { 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; return -1;
} }

View File

@ -231,7 +231,7 @@ public class yacyCore {
public final void run() { public final void run() {
try { 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) { if (this.added < 0) {
// no or wrong response, delete that address // no or wrong response, delete that address
final String cause = "peer ping to peer resulted in error response (added < 0)"; final String cause = "peer ping to peer resulted in error response (added < 0)";