added some attributes to network picture

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2032 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent cbcf7418ef
commit b0036249c1

@ -61,6 +61,7 @@ public class NetworkPicture {
int passiveLimit = 300;
int potentialLimit = 300;
int maxCount = 1000;
boolean corona = true;
if (post != null) {
width = post.getInt("width", 640);
@ -68,17 +69,18 @@ public class NetworkPicture {
passiveLimit = post.getInt("pal", 300);
potentialLimit = post.getInt("pol", 300);
maxCount = post.getInt("max", 1000);
corona = post.get("corona", "true").equals("true");
}
//too small values lead to an error, too big to huge CPU/memory consumption, resulting in possible DOS.
if (width < 320 ) width = 320;
if (width > 1920) width = 1920;
if (height < 240) height = 240;
if (height > 1200) height = 1200;
if (height > 1920) height = 1920;
if (passiveLimit > 1000000) passiveLimit = 1000000;
if (potentialLimit > 1000000) potentialLimit = 1000000;
if (maxCount > 1000) maxCount = 1000;
return plasmaGrafics.getNetworkPicture(10000, width, height, passiveLimit, potentialLimit, maxCount);
return plasmaGrafics.getNetworkPicture(10000, width, height, passiveLimit, potentialLimit, maxCount, corona);
}
}

@ -732,16 +732,6 @@ public final class httpc {
if (!(header.containsKey(httpHeader.CONNECTION))) {
header.put(httpHeader.CONNECTION, "close");
}
// advertise a little bit...
/*
if ( (!(header.containsKey(httpHeader.REFERER))) || (((String) header.get(httpHeader.REFERER)).trim().length() == 0)&& useYacyReferer ) {
header.put(httpHeader.REFERER,
(((System.currentTimeMillis() >> 10) & 1) == 0) ?
"http://www.anomic.de" :
"http://www.yacy.net/yacy");
}
*/
// stimulate zipping or not
// we can unzip, and we will return it always as unzipped, unless not wanted

@ -327,9 +327,7 @@ public final class plasmaCrawlWorker extends Thread {
// TODO: resolve yacy and yacyh domains
//String yAddress = yacyCore.seedDB.resolveYacyAddress(host);
// set referrer; in some case advertise a little bit:
referer = (referer == null) ? "" : referer.trim();
if (referer.length() == 0) referer = "http://www.yacy.net/yacy/";
// take a file from the net
httpc remote = null;

@ -106,17 +106,17 @@ public class plasmaGrafics {
}
public static ymagePainter getNetworkPicture(long maxAge) {
return getNetworkPicture(maxAge, 640, 480, 300, 300, 1000);
return getNetworkPicture(maxAge, 640, 480, 300, 300, 1000, true);
}
public static ymagePainter getNetworkPicture(long maxAge, int width, int height, int passiveLimit, int potentialLimit, int maxCount) {
public static ymagePainter getNetworkPicture(long maxAge, int width, int height, int passiveLimit, int potentialLimit, int maxCount, boolean corona) {
if ((networkPicture == null) || ((System.currentTimeMillis() - networkPictureDate) > maxAge)) {
drawNetworkPicture(width, height, passiveLimit, potentialLimit, maxCount);
drawNetworkPicture(width, height, passiveLimit, potentialLimit, maxCount, corona);
}
return networkPicture;
}
private static void drawNetworkPicture(int width, int height, int passiveLimit, int potentialLimit, int maxCount) {
private static void drawNetworkPicture(int width, int height, int passiveLimit, int potentialLimit, int maxCount, boolean corona) {
int innerradius = Math.min(width, height) / 5;
int outerradius = innerradius + innerradius * yacyCore.seedDB.sizeConnected() / 100;
@ -144,7 +144,7 @@ public class plasmaGrafics {
while (e.hasMoreElements() && count < maxCount) {
seed = (yacySeed) e.nextElement();
if (seed != null) {
drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, seed, "000040", "608860", "B0FFB0");
drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, seed, "000040", "608860", "B0FFB0", corona);
count++;
}
}
@ -158,7 +158,7 @@ public class plasmaGrafics {
if (seed != null) {
lastseen = Math.abs((System.currentTimeMillis() - seed.getLastSeenTime()) / 1000 / 60);
if (lastseen > passiveLimit) break; // we have enough, this list is sorted so we don't miss anything
drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, seed, "101010", "401000", "802000");
drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, seed, "101010", "401000", "802000", corona);
count++;
}
}
@ -172,14 +172,14 @@ public class plasmaGrafics {
if (seed != null) {
lastseen = Math.abs((System.currentTimeMillis() - seed.getLastSeenTime()) / 1000 / 60);
if (lastseen > potentialLimit) break; // we have enough, this list is sorted so we don't miss anything
drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, seed, "202000", "505000", "A0A000");
drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, seed, "202000", "505000", "A0A000", corona);
count++;
}
}
totalCount += count;
// draw my own peer
drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, yacyCore.seedDB.mySeed, "800000", "AAAAAA", "FFFFFF");
drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, yacyCore.seedDB.mySeed, "800000", "AAAAAA", "FFFFFF", corona);
// draw description
networkPicture.setColor("FFFFFF");
@ -192,7 +192,7 @@ public class plasmaGrafics {
networkPictureDate = System.currentTimeMillis();
}
private static void drawNetworkPicturePeer(ymagePainter img, int x, int y, int innerradius, int outerradius, yacySeed seed, String colorDot, String colorLine, String colorText) {
private static void drawNetworkPicturePeer(ymagePainter img, int x, int y, int innerradius, int outerradius, yacySeed seed, String colorDot, String colorLine, String colorText, boolean corona) {
String name = seed.getName().toUpperCase();
if (name.length() < shortestName) shortestName = name.length();
if (name.length() > longestName) longestName = name.length();
@ -212,9 +212,10 @@ public class plasmaGrafics {
// draw text
img.setColor(colorText);
img.arcPrint(x, y, innerradius + linelength, angle, name);
// draw corona around dot for crawling activity
int ppm10 = seed.getPPM() / 10;
if (ppm10 > 0) {
if ((corona) && (ppm10 > 0)) {
if (ppm10 > 3) ppm10 = 3;
// draw a wave around crawling peers
long strength;

Loading…
Cancel
Save