Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- fixes to node identification - added link to node in network list - added marking of portal search node peers
Michael Peter Christen71c3163f3df3
diff --git a/htroot/Network.html b/htroot/Network.htmlindex e6cfd0f26..105d7e034 100644--- a/htroot/Network.html+++ b/htroot/Network.html@@ -146,8 +146,9 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de#(updatedBlog)#::<a href="http://#[address]#/Blog.html?page=#[page]#" title="#[subject]#"><img src="/env/grafics/blog.gif" width="54" height="11" alt="Blog updated" /></a>#(/updatedBlog)##(isCrawling)#::<a href="#[page]#"><img src="/env/grafics/crawl.gif" width="54" height="11" alt="Crawl" /></a>#(/isCrawling)#</td>- <td><a href="http://www.#[fullname]#.yacy">#[shortname]#</a></td>- <td width="34">#(type)##(direct)#<img src="/env/grafics/JuniorPassive.gif" width="11" height="11" title="Type: Junior | Contact: passive" alt="Junior passive" />::<img src="/env/grafics/JuniorDirect.gif" width="11" height="11" title="Type: Junior | Contact: direct" alt="Junior direct" />::<img src="/env/grafics/JuniorOffline.gif" width="11" height="11" title="Type: Junior | Contact: offline" alt="Junior offline" />#(/direct)#::#(direct)#<img src="/env/grafics/SeniorPassive.gif" width="11" height="11" title="Type: Senior | Contact: passive" alt="senior passive" />::<img src="/env/grafics/SeniorDirect.gif" width="11" height="11" title="Type: Senior | Contact: direct" alt="Senior direct" />::<img src="/env/grafics/SeniorOffline.gif" width="11" height="11" title="Type: Senior | Contact: offline" alt="Senior offline" />#(/direct)#::<a href="#[url]#">#(direct)#<img src="/env/grafics/PrincipalPassive.gif" width="11" height="11" title="Type: Principal | Contact: passive | Seed download: possible" alt="Principal passive" />::<img src="/env/grafics/PrincipalDirect.gif" width="11" height="11" title="Type: Principal | Contact: direct | Seed download: possible" alt="Principal active" />::<img src="/env/grafics/PrincipalOffline.gif" width="11" height="11" title="Type: Principal | Contact: offline | Seed download: ?" alt="Principal offline" />#(/direct)#</a>#(/type)##(acceptcrawl)#<img src="/env/grafics/CrawlNo.gif" width="11" height="11" title="Accept Crawl: no" alt="no crawl" />::<img src="/env/grafics/CrawlYes.gif" width="11" height="11" title="Accept Crawl: yes" alt="crawl possible" />::<img src="/env/grafics/CrawlYesOffline.gif" width="11" height="11" title="Accept Crawl: yes" alt="crawl possible" />#(/acceptcrawl)##(dhtreceive)#<img src="/env/grafics/DHTReceiveNo.gif" width="11" height="11" title="DHT Receive: no; #[peertags]#" alt="no DHT receive" />::<img src="/env/grafics/DHTReceiveYes.gif" width="11" height="11" title="DHT Receive: yes" alt="DHT receive enabled" />::<img src="/env/grafics/DHTReceiveYesOffline.gif" width="11" height="11" title="DHT Receive: yes" alt="DHT receive enabled" />#(/dhtreceive)##(nodestate)#<img src="/env/grafics/RootStateNo.gif" width="11" height="11" title="Not a Node Candidate" alt="no node candidate" />::<img src="/env/grafics/RootStateYes.gif" width="11" height="11" title="Node Candidate" alt="node candidate" />#(/nodestate)#</td>+ <td #(special)#::class="TableCellActive"#(/special)#><a href="http://www.#[fullname]#.yacy">#[shortname]#</a></td>+ <td width="44">+ #(type)##(direct)#<img src="/env/grafics/JuniorPassive.gif" width="11" height="11" title="Type: Junior | Contact: passive" alt="Junior passive" />::<img src="/env/grafics/JuniorDirect.gif" width="11" height="11" title="Type: Junior | Contact: direct" alt="Junior direct" />::<img src="/env/grafics/JuniorOffline.gif" width="11" height="11" title="Type: Junior | Contact: offline" alt="Junior offline" />#(/direct)#::#(direct)#<img src="/env/grafics/SeniorPassive.gif" width="11" height="11" title="Type: Senior | Contact: passive" alt="senior passive" />::<img src="/env/grafics/SeniorDirect.gif" width="11" height="11" title="Type: Senior | Contact: direct" alt="Senior direct" />::<img src="/env/grafics/SeniorOffline.gif" width="11" height="11" title="Type: Senior | Contact: offline" alt="Senior offline" />#(/direct)#::<a href="#[url]#">#(direct)#<img src="/env/grafics/PrincipalPassive.gif" width="11" height="11" title="Type: Principal | Contact: passive | Seed download: possible" alt="Principal passive" />::<img src="/env/grafics/PrincipalDirect.gif" width="11" height="11" title="Type: Principal | Contact: direct | Seed download: possible" alt="Principal active" />::<img src="/env/grafics/PrincipalOffline.gif" width="11" height="11" title="Type: Principal | Contact: offline | Seed download: ?" alt="Principal offline" />#(/direct)#</a>#(/type)##(acceptcrawl)#<img src="/env/grafics/CrawlNo.gif" width="11" height="11" title="Accept Crawl: no" alt="no crawl" />::<img src="/env/grafics/CrawlYes.gif" width="11" height="11" title="Accept Crawl: yes" alt="crawl possible" />::<img src="/env/grafics/CrawlYesOffline.gif" width="11" height="11" title="Accept Crawl: yes" alt="crawl possible" />#(/acceptcrawl)##(dhtreceive)#<img src="/env/grafics/DHTReceiveNo.gif" width="11" height="11" title="DHT Receive: no; #[peertags]#" alt="no DHT receive" />::<img src="/env/grafics/DHTReceiveYes.gif" width="11" height="11" title="DHT Receive: yes" alt="DHT receive enabled" />::<img src="/env/grafics/DHTReceiveYesOffline.gif" width="11" height="11" title="DHT Receive: yes" alt="DHT receive enabled" />#(/dhtreceive)##(nodestate)#<img src="/env/grafics/RootStateNo.gif" width="11" height="11" title="Not a Node Candidate" alt="no node candidate" />::<a href="http://#[ip]#:#[port]#/Network.html?page=1"><img src="/env/grafics/RootStateYes.gif" width="11" height="11" title="Node Candidate" alt="node candidate" /></a>#(/nodestate)#</td><td align="right">#[version]#</td><td align="right">#[ppm]#</td><td align="right">#[qph]#</td>@@ -256,7 +257,7 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de</tr><tr class="TableCellDark"><td>#[my-name]#</td>- <td>#(my-info)#<img src="/env/grafics/Virgin.gif" width="11" height="11" title="Type: Virgin" alt="Virgin" />::<img src="/env/grafics/JuniorDirect.gif" width="11" height="11" title="Type: Junior" alt="Junior" />::<img src="/env/grafics/SeniorDirect.gif" width="11" height="11" title="Type: Senior" alt="Senior" />::<img src="/env/grafics/PrincipalDirect.gif" width="11" height="11" title="Type: Principal" alt="Principal" />#(/my-info)##(my-acceptcrawl)#<img src="/env/grafics/CrawlNo.gif" width="11" height="11" title="Accept Crawl: no" alt="no crawl" />::<img src="/env/grafics/CrawlYes.gif" width="11" height="11" title="Accept Crawl: yes" alt="Crawl enabled" />#(/my-acceptcrawl)##(my-dhtreceive)#<img src="/env/grafics/DHTReceiveNo.gif" width="11" height="11" title="DHT Receive: no" alt="no DHT receive" />::<img src="/env/grafics/DHTReceiveYes.gif" width="11" height="11" title="DHT Receive: yes" alt="DHT Receive enabled" />#(/my-dhtreceive)#</td>+ <td>#(my-info)#<img src="/env/grafics/Virgin.gif" width="11" height="11" title="Type: Virgin" alt="Virgin" />::<img src="/env/grafics/JuniorDirect.gif" width="11" height="11" title="Type: Junior" alt="Junior" />::<img src="/env/grafics/SeniorDirect.gif" width="11" height="11" title="Type: Senior" alt="Senior" />::<img src="/env/grafics/PrincipalDirect.gif" width="11" height="11" title="Type: Principal" alt="Principal" />#(/my-info)##(my-acceptcrawl)#<img src="/env/grafics/CrawlNo.gif" width="11" height="11" title="Accept Crawl: no" alt="no crawl" />::<img src="/env/grafics/CrawlYes.gif" width="11" height="11" title="Accept Crawl: yes" alt="Crawl enabled" />#(/my-acceptcrawl)##(my-dhtreceive)#<img src="/env/grafics/DHTReceiveNo.gif" width="11" height="11" title="DHT Receive: no" alt="no DHT receive" />::<img src="/env/grafics/DHTReceiveYes.gif" width="11" height="11" title="DHT Receive: yes" alt="DHT Receive enabled" />#(/my-dhtreceive)##(my-nodestate)#<img src="/env/grafics/RootStateNo.gif" width="11" height="11" title="Not a Node Candidate" alt="no node candidate" />::<img src="/env/grafics/RootStateYes.gif" width="11" height="11" title="Node Candidate" alt="node candidate" />#(/my-nodestate)#</td><td align="right">#[my-version]#</td><td align="right">#[my-utc]#</td><td align="right">#[my-uptime]#</td>diff --git a/htroot/Network.java b/htroot/Network.javaindex 9a9163492..7bd81feb1 100644--- a/htroot/Network.java+++ b/htroot/Network.java@@ -120,7 +120,7 @@ public class Network {}prop.put("table_my-acceptcrawl", seed.getFlagAcceptRemoteCrawl() ? 1 : 0);prop.put("table_my-dhtreceive", seed.getFlagAcceptRemoteIndex() ? 1 : 0);-+ prop.put("table_my-nodestate", seed.getFlagRootNode() ? 1 : 0);myppm = sb.currentPPM();myqph = 60d * sb.averageQPM();@@ -361,6 +361,7 @@ public class Network {}prop.putHTML(STR_TABLE_LIST + conCount + "_shortname", shortname);prop.putHTML(STR_TABLE_LIST + conCount + "_fullname", seed.get(Seed.NAME, "deadlink"));+ prop.put(STR_TABLE_LIST + conCount + "_special", (seed.getFlagRootNode() && !seed.getFlagAcceptRemoteIndex()) ? 1 : 0);userAgent = null;if (seed.hash != null && seed.hash.equals(sb.peers.mySeed().hash)) {userAgent = ClientIdentification.getUserAgent();@@ -421,14 +422,17 @@ public class Network {prop.put(STR_TABLE_LIST + conCount + "_dhtreceive", 0); // red/red; offline was off}}- prop.put(STR_TABLE_LIST + conCount + "_nodestate", seed.getFlagRootNode() ? 0 : 1);+ prop.put(STR_TABLE_LIST + conCount + "_nodestate", seed.getFlagRootNode() ? 1 : 0);+ prop.put(STR_TABLE_LIST + conCount + "_nodestate_ip", seed.getIP() );+ prop.put(STR_TABLE_LIST + conCount + "_nodestate_port", seed.get(Seed.PORT, "-") );if (seed.getFlagAcceptRemoteIndex()) {prop.put(STR_TABLE_LIST + conCount + "_dhtreceive_peertags", "");} else {final String peertags = MapTools.set2string(seed.getPeerTags(), ",", false);prop.putHTML(STR_TABLE_LIST + conCount + "_dhtreceive_peertags", ((peertags == null) || (peertags.length() == 0)) ? "no tags given" : ("tags = " + peertags));}- prop.putHTML(STR_TABLE_LIST + conCount + "_version", yacyVersion.combined2prettyVersion(seed.get(Seed.VERSION, "0.1"), shortname));+ String[] yv = yacyVersion.combined2prettyVersion(seed.get(Seed.VERSION, "0.1"), shortname);+ prop.putHTML(STR_TABLE_LIST + conCount + "_version", yv[0] + "/" + yv[1]);prop.putNum(STR_TABLE_LIST + conCount + "_lastSeen", /*seed.getLastSeenString() + " " +*/ lastseen);prop.put(STR_TABLE_LIST + conCount + "_utc", seed.get(Seed.UTC, "-"));prop.putHTML(STR_TABLE_LIST + conCount + "_uptime", PeerActions.formatInterval(60000 * seed.getLong(Seed.UPTIME, 0)));diff --git a/htroot/RemoteCrawl_p.java b/htroot/RemoteCrawl_p.javaindex b9216ab17..1f3df50ca 100644--- a/htroot/RemoteCrawl_p.java+++ b/htroot/RemoteCrawl_p.java@@ -10,7 +10,7 @@// $LastChangedBy: orbiter $//// LICENSE-//+//// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or@@ -36,7 +36,6 @@ import net.yacy.peers.Seed;import net.yacy.peers.operation.yacyVersion;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;-import de.anomic.data.WorkTables;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;@@ -44,18 +43,18 @@ import de.anomic.server.serverSwitch;public class RemoteCrawl_p {public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {-+final Switchboard sb = (Switchboard) env;final serverObjects prop = new serverObjects();-+if (post != null) {-+// store this call as api callsb.tables.recordAPICall(post, "RemoteCrawl_p.html", WorkTables.TABLE_API_TYPE_CONFIGURATION, "remote crawler configuration");-+if (post.containsKey("crawlResponse")) {boolean crawlResponse = post.get("crawlResponse", "off").equals("on");-+// read remote crawl request settingssb.setConfig("crawlResponse", crawlResponse);}@@ -69,16 +68,16 @@ public class RemoteCrawl_p {sb.setRemotecrawlPPM(newppm);}}-+// write remote crawl request settingsprop.put("crawlResponse", sb.getConfigBool("crawlResponse", false) ? "1" : "0");long RTCbusySleep = Math.max(1, env.getConfigLong(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_BUSYSLEEP, 100));final int RTCppm = (int) (60000L / RTCbusySleep);prop.put("acceptCrawlLimit", RTCppm);-+// set seed information directlysb.peers.mySeed().setFlagAcceptRemoteCrawl(sb.getConfigBool("crawlResponse", false));-+// -------------------------------------------------------------------------------------// write network listfinal String STR_TABLE_LIST = "list_";@@ -112,11 +111,12 @@ public class RemoteCrawl_p {}prop.put(STR_TABLE_LIST + conCount + "_dark", ((dark) ? 1 : 0) ); dark=!dark;String shortname = seed.get(Seed.NAME, "deadlink");- if (shortname.length() > 20) shortname = shortname.substring(0, 20) + "...";+ if (shortname.length() > 20) shortname = shortname.substring(0, 20) + "...";prop.putHTML(STR_TABLE_LIST + conCount + "_shortname", shortname);prop.putHTML(STR_TABLE_LIST + conCount + "_fullname", seed.get(Seed.NAME, "deadlink"));prop.put(STR_TABLE_LIST + conCount + "_age", seed.getAge());- prop.putHTML(STR_TABLE_LIST + conCount + "_version", yacyVersion.combined2prettyVersion(seed.get(Seed.VERSION, "0.1"), shortname));+ String[] yv = yacyVersion.combined2prettyVersion(seed.get(Seed.VERSION, "0.1"), shortname);+ prop.putHTML(STR_TABLE_LIST + conCount + "_version", yv[0] + "/" + yv[1]);prop.putNum(STR_TABLE_LIST + conCount + "_lastSeen", /*seed.getLastSeenString() + " " +*/ lastseen);prop.put(STR_TABLE_LIST + conCount + "_utc", seed.get(Seed.UTC, "-"));prop.putHTML(STR_TABLE_LIST + conCount + "_uptime", PeerActions.formatInterval(60000 * seed.getLong(Seed.UPTIME, 0L)));@@ -129,7 +129,7 @@ public class RemoteCrawl_p {} // seed != null} // whileprop.putNum("list", conCount);-+return prop;}}diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.javaindex 408bc844f..5ed193426 100644--- a/htroot/yacy/hello.java+++ b/htroot/yacy/hello.java@@ -37,9 +37,9 @@ import net.yacy.cora.protocol.Domains;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.kelondro.logging.Log;-import net.yacy.peers.Seed;-import net.yacy.peers.Protocol;import net.yacy.peers.Network;+import net.yacy.peers.Protocol;+import net.yacy.peers.Seed;import net.yacy.peers.dht.PeerSelection;import net.yacy.peers.graphics.ProfilingGraph;import net.yacy.peers.operation.yacyVersion;@@ -112,7 +112,7 @@ public final class hello {final String userAgent = header.get(HeaderFramework.USER_AGENT, "<unknown>");final String reportedip = remoteSeed.getIP();final String reportedPeerType = remoteSeed.get(Seed.PEERTYPE, Seed.PEERTYPE_JUNIOR);- final float clientversion = remoteSeed.getVersion();+ final double clientversion = remoteSeed.getVersion();if (sb.isRobinsonMode() && !sb.isPublicRobinson()) {// if we are a robinson cluster, answer only if this client is known by our network definitiondiff --git a/source/net/yacy/peers/Seed.java b/source/net/yacy/peers/Seed.javaindex a3e1daf49..d8f58421f 100644--- a/source/net/yacy/peers/Seed.java+++ b/source/net/yacy/peers/Seed.java@@ -247,7 +247,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>/*** check the peer name: protect against usage as XSS hack- *+ ** @param id* @return a checked name without "<" and ">"*/@@ -260,7 +260,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>/*** generate a default peer name- *+ ** @return*/private static String defaultPeerName() {@@ -274,7 +274,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>/*** Checks for the static fragments of a generated default peer name, such as the string 'dpn'- *+ ** @see #makeDefaultPeerName()* @param name the peer name to check for default peer name compliance* @return whether the given peer name may be a default generated peer name@@ -301,7 +301,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>/*** try to get the IP<br>- *+ ** @return the IP or null*/public final String getIP() {@@ -311,7 +311,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>/*** try to get the peertype<br>- *+ ** @return the peertype or null*/public final String getPeerType() {@@ -320,7 +320,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>/*** try to get the peertype<br>- *+ ** @return the peertype or "virgin"*/public final String orVirgin() {@@ -329,7 +329,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>/*** try to get the peertype<br>- *+ ** @return the peertype or "junior"*/public final String orJunior() {@@ -338,7 +338,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>/*** try to get the peertype<br>- *+ ** @return the peertype or "senior"*/public final String orSenior() {@@ -347,7 +347,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>/*** try to get the peertype<br>- *+ ** @return the peertype or "principal"*/public final String orPrincipal() {@@ -356,7 +356,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>/*** Get a value from the peer's DNA (its set of peer defining values, e.g. IP, name, version, ...)- *+ ** @param key the key for the value to fetch* @param dflt the default value*/@@ -503,7 +503,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>* Cause: the natural order of octal hashes are the same as the b64-order of b64Hashes. a hexhash cannot* be used in such cases, and b64Hashes are not appropriate for file names* </p>- *+ ** @param b64Hash a base64 hash* @return the octal representation of the given base64 hash*/@@ -513,7 +513,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>/*** <code>12 * 6 bit = 72 bit = 18</code> characters hex-hash- *+ ** @param b64Hash a base64 hash* @return the hexadecimal representation of the given base64 hash*/@@ -535,21 +535,21 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>/*** The returned version follows this pattern: <code>MAJORVERSION . MINORVERSION 0 SVN REVISION</code>- *+ ** @return the YaCy version of this peer as a float or <code>0</code> if no valid value could be retrieved* from this yacySeed object*/- public final float getVersion() {+ public final Double getVersion() {try {- return Float.parseFloat(get(Seed.VERSION, Seed.ZERO));+ return Double.parseDouble(get(Seed.VERSION, Seed.ZERO));} catch ( final NumberFormatException e ) {- return 0;+ return 0.0d;}}/*** get the SVN version of the peer- *+ ** @return*/public final int getRevision() {@@ -582,7 +582,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>* If this seed is part of a cluster, the peer has probably the {@linkplain #alternativeIP} object set to* a local IP. If this is present and the public IP of this peer is identical to the public IP of the own* seed, construct an address using this IP; otherwise return the public address- *+ ** @see #getPublicAddress()* @return the alternative IP:port if present, else the public address*/@@ -654,7 +654,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>/*** test if the lastSeen time of the seed has a time-out- *+ ** @param milliseconds the maximum age of the last-seen value* @return true, if the time between the last-seen time and now is greater then the given time-out*/@@ -765,30 +765,32 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>public final void setFlagAcceptRemoteIndex(final boolean value) {setFlag(FLAG_ACCEPT_REMOTE_INDEX, value);}-+public final void setFlagRootNode(final boolean value) {setFlag(FLAG_ROOT_NODE, value);}-+public final boolean getFlagDirectConnect() {- return getFlag(0);+ return getFlag(FLAG_DIRECT_CONNECT);}public final boolean getFlagAcceptRemoteCrawl() {//if (getVersion() < 0.300) return false;//if (getVersion() < 0.334) return true;- return getFlag(1);+ return getFlag(FLAG_ACCEPT_REMOTE_CRAWL);}public final boolean getFlagAcceptRemoteIndex() {//if (getVersion() < 0.335) return false;- return getFlag(2);+ return getFlag(FLAG_ACCEPT_REMOTE_INDEX);}public final boolean getFlagRootNode() {+ double v = getVersion();+ if (v < 1.02009142d) return false;return getFlag(FLAG_ROOT_NODE);}-+public final void setUnusedFlags() {for ( int i = 4; i < 24; i++ ) {setFlag(i, false);diff --git a/source/net/yacy/peers/SeedDB.java b/source/net/yacy/peers/SeedDB.javaindex 7d16d8af7..2f29e8cde 100644--- a/source/net/yacy/peers/SeedDB.java+++ b/source/net/yacy/peers/SeedDB.java@@ -413,17 +413,17 @@ public final class SeedDB implements AlternativeDomainNames {return clustermap;}- public Iterator<Seed> seedsConnected(final boolean up, final boolean rot, final byte[] firstHash, final float minVersion) {+ public Iterator<Seed> seedsConnected(final boolean up, final boolean rot, final byte[] firstHash, final double minVersion) {// enumerates seed-type objects: all seeds sequentially without orderreturn new seedEnum(up, rot, (firstHash == null) ? null : firstHash, null, this.seedActiveDB, minVersion);}- private Iterator<Seed> seedsDisconnected(final boolean up, final boolean rot, final byte[] firstHash, final float minVersion) {+ private Iterator<Seed> seedsDisconnected(final boolean up, final boolean rot, final byte[] firstHash, final double minVersion) {// enumerates seed-type objects: all seeds sequentially without orderreturn new seedEnum(up, rot, (firstHash == null) ? null : firstHash, null, this.seedPassiveDB, minVersion);}- public Seed anySeedVersion(final float minVersion) {+ public Seed anySeedVersion(final double minVersion) {// return just any seed that has a specific minimum version numberfinal Iterator<Seed> e = seedsConnected(true, true, Seed.randomHash(), minVersion);return e.next();@@ -938,14 +938,14 @@ public final class SeedDB implements AlternativeDomainNames {private Iterator<Map.Entry<byte[], Map<String, String>>> it;private Seed nextSeed;private final MapDataMining database;- private float minVersion;+ private double minVersion;- private seedEnum(final boolean up, final boolean rot, final byte[] firstKey, final byte[] secondKey, final MapDataMining database, final float minVersion) {+ private seedEnum(final boolean up, final boolean rot, final byte[] firstKey, final byte[] secondKey, final MapDataMining database, final double minVersion) {this.database = database;this.minVersion = minVersion;try {this.it = (firstKey == null) ? database.entries(up, rot) : database.entries(up, rot, firstKey, secondKey);- float version;+ double version;while (true) {this.nextSeed = internalNext();if (this.nextSeed == null) break;@@ -1023,7 +1023,7 @@ public final class SeedDB implements AlternativeDomainNames {public Seed next() {final Seed seed = this.nextSeed;- float version;+ double version;try {while (true) {this.nextSeed = internalNext();if (this.nextSeed == null) break;diff --git a/source/net/yacy/peers/dht/PeerSelection.java b/source/net/yacy/peers/dht/PeerSelection.javaindex 1ea0d9e96..334345167 100644--- a/source/net/yacy/peers/dht/PeerSelection.java+++ b/source/net/yacy/peers/dht/PeerSelection.java@@ -1,4 +1,4 @@-// PeerSelection.java+// PeerSelection.java// -------------------------------------// (C) by Michael Peter Christen; [email protected]// first published 05.11.2008 on http://yacy.net@@ -84,18 +84,18 @@ public class PeerSelection {// the result is ordered by relevance: [0] is most relevant// the seedcount is the maximum number of wanted resultsif (seedDB == null) { return null; }-+// put in seeds according to dhtfinal Map<String, Seed> regularSeeds = new HashMap<String, Seed>(); // dht position seedsSeed seed;- Iterator<Seed> dhtEnum;+ Iterator<Seed> dhtEnum;Iterator<byte[]> iter = wordhashes.iterator();while (iter.hasNext()) {selectDHTPositions(seedDB, iter.next(), redundancy, regularSeeds);}//int minimumseeds = Math.min(seedDB.scheme.verticalPartitions(), regularSeeds.size()); // that should be the minimum number of seeds that are returned//int maximumseeds = seedDB.scheme.verticalPartitions() * redundancy; // this is the maximum number of seeds according to dht and heuristics. It can be more using burst mode.-+// put in some seeds according to size of peer.// But not all, that would produce too much load on the largest peersdhtEnum = seedDB.seedsSortedConnected(false, Seed.ICOUNT);@@ -159,7 +159,7 @@ public class PeerSelection {regularSeeds.put(seed.hash, seed);}}-+// produce return setSeed[] result = new Seed[regularSeeds.size()];result = regularSeeds.values().toArray(result);@@ -167,9 +167,9 @@ public class PeerSelection {}private static void selectDHTPositions(- final SeedDB seedDB,+ final SeedDB seedDB,byte[] wordhash,- int redundancy,+ int redundancy,Map<String, Seed> regularSeeds) {// this method is called from the search target computationfinal long[] dhtVerticalTargets = seedDB.scheme.dhtPositions(wordhash);@@ -193,7 +193,7 @@ public class PeerSelection {public static byte[] selectTransferStart() {return ASCII.getBytes(Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw(Long.toString(System.currentTimeMillis()))).substring(2, 2 + Word.commonHashLength));}-+public static byte[] limitOver(final SeedDB seedDB, final byte[] startHash) {final Iterator<Seed> seeds = getAcceptRemoteIndexSeeds(seedDB, startHash, 1, false);if (seeds.hasNext()) return ASCII.getBytes(seeds.next().hash);@@ -210,7 +210,7 @@ public class PeerSelection {while (seedIter.hasNext() && max-- > 0) targets.add(seedIter.next());return targets;}-+/*** returns an enumeration of yacySeed-Objects that have the AcceptRemoteIndex-Flag set* the seeds are enumerated in the right order according to the DHT@@ -223,7 +223,7 @@ public class PeerSelection {public static Iterator<Seed> getAcceptRemoteIndexSeeds(final SeedDB seedDB, final byte[] starthash, final int max, final boolean alsoMyOwn) {return new acceptRemoteIndexSeedEnum(seedDB, starthash, Math.min(max, seedDB.sizeConnected()), alsoMyOwn);}-+private static class acceptRemoteIndexSeedEnum implements Iterator<Seed> {private final Iterator<Seed> se;@@ -232,7 +232,7 @@ public class PeerSelection {private final HandleSet doublecheck;private int remaining;private final boolean alsoMyOwn;-+private acceptRemoteIndexSeedEnum(SeedDB seedDB, final byte[] starthash, int max, boolean alsoMyOwn) {this.seedDB = seedDB;this.se = getDHTSeeds(seedDB, starthash, yacyVersion.YACY_HANDLES_COLLECTION_INDEX, alsoMyOwn);@@ -241,7 +241,7 @@ public class PeerSelection {this.nextSeed = nextInternal();this.alsoMyOwn = alsoMyOwn;}-+@Overridepublic boolean hasNext() {return this.nextSeed != null;@@ -264,7 +264,7 @@ public class PeerSelection {}if (s.getFlagAcceptRemoteIndex() ||(this.alsoMyOwn && s.hash.equals(this.seedDB.mySeed().hash)) // Accept own peer regardless of FlagAcceptRemoteIndex- ) {+ ) {this.remaining--;return s;}@@ -277,7 +277,7 @@ public class PeerSelection {}return null;}-+@Overridepublic Seed next() {final Seed next = this.nextSeed;@@ -291,7 +291,7 @@ public class PeerSelection {}}-+/*** enumerate seeds for DHT target positions* @param seedDB@@ -299,12 +299,12 @@ public class PeerSelection {* @param minVersion* @return*/- protected static Iterator<Seed> getDHTSeeds(final SeedDB seedDB, final byte[] firstHash, final float minVersion) {+ protected static Iterator<Seed> getDHTSeeds(final SeedDB seedDB, final byte[] firstHash, final double minVersion) {// enumerates seed-type objects: all seeds with starting point in the middle, rotating at the end/beginningreturn new seedDHTEnum(seedDB, firstHash, minVersion, false);}- protected static Iterator<Seed> getDHTSeeds(final SeedDB seedDB, final byte[] firstHash, final float minVersion, final boolean alsoMyOwn) {+ protected static Iterator<Seed> getDHTSeeds(final SeedDB seedDB, final byte[] firstHash, final double minVersion, final boolean alsoMyOwn) {// enumerates seed-type objects: all seeds with starting point in the middle, rotating at the end/beginningreturn new seedDHTEnum(seedDB, firstHash, minVersion, alsoMyOwn);}@@ -312,13 +312,13 @@ public class PeerSelection {private Iterator<Seed> e;private int steps;- private final float minVersion;+ private final double minVersion;private final SeedDB seedDB;private boolean alsoMyOwn;private int pass, insertOwnInPass;private Seed nextSeed;-- private seedDHTEnum(final SeedDB seedDB, final byte[] firstHash, final float minVersion, final boolean alsoMyOwn) {++ private seedDHTEnum(final SeedDB seedDB, final byte[] firstHash, final double minVersion, final boolean alsoMyOwn) {this.seedDB = seedDB;this.steps = seedDB.sizeConnected() + ((alsoMyOwn) ? 1 : 0);this.minVersion = minVersion;@@ -332,7 +332,7 @@ public class PeerSelection {}this.nextSeed = nextInternal();}-+@Overridepublic boolean hasNext() {return (this.nextSeed != null) || this.alsoMyOwn;@@ -341,7 +341,7 @@ public class PeerSelection {public Seed nextInternal() {if (this.steps == 0) return null;this.steps--;-+if (!this.e.hasNext() && this.pass == 1) {this.e = this.seedDB.seedsConnected(true, false, null, this.minVersion);this.pass = 2;@@ -375,7 +375,7 @@ public class PeerSelection {throw new UnsupportedOperationException();}}-+/*** enumerate peers that provide remote crawl urls* @param seedDB@@ -384,19 +384,19 @@ public class PeerSelection {public static Iterator<Seed> getProvidesRemoteCrawlURLs(final SeedDB seedDB) {return new providesRemoteCrawlURLsEnum(seedDB);}-+private static class providesRemoteCrawlURLsEnum implements Iterator<Seed> {private final Iterator<Seed> se;private Seed nextSeed;private final SeedDB seedDB;-+private providesRemoteCrawlURLsEnum(final SeedDB seedDB) {this.seedDB = seedDB;this.se = getDHTSeeds(seedDB, null, yacyVersion.YACY_POVIDES_REMOTECRAWL_LISTS);this.nextSeed = nextInternal();}-+@Overridepublic boolean hasNext() {return this.nextSeed != null;@@ -418,7 +418,7 @@ public class PeerSelection {}return null;}-+@Overridepublic Seed next() {final Seed next = this.nextSeed;@@ -442,14 +442,14 @@ public class PeerSelection {* @return a hash map of peer hashes to seed object*/public static Map<String, Seed> seedsByAgeX(final SeedDB seedDB, final boolean up, int count) {-+if (count > seedDB.sizeConnected()) count = seedDB.sizeConnected();// fill a score objectfinal ScoreMap<String> seedScore = new ConcurrentScoreMap<String>();Seed ys;long absage;- final Iterator<Seed> s = seedDB.seedsSortedConnected(!up, Seed.LASTSEEN);+ final Iterator<Seed> s = seedDB.seedsSortedConnected(!up, Seed.LASTSEEN);int searchcount = 1000;if (searchcount > seedDB.sizeConnected()) searchcount = seedDB.sizeConnected();try {@@ -461,7 +461,7 @@ public class PeerSelection {seedScore.inc(ys.hash, (int) absage); // the higher absage, the older is the peer} catch (final Exception e) {}}-+// result is now in the score object; create a result vectorfinal Map<String, Seed> result = new HashMap<String, Seed>();final Iterator<String> it = seedScore.keys(up);@@ -477,7 +477,7 @@ public class PeerSelection {return null;}}-+/**@@ -491,7 +491,7 @@ public class PeerSelection {if (count > seedDB.sizeConnected()) count = seedDB.sizeConnected();Seed ys;//long age;- final Iterator<Seed> s = seedDB.seedsSortedConnected(!up, Seed.LASTSEEN);+ final Iterator<Seed> s = seedDB.seedsSortedConnected(!up, Seed.LASTSEEN);try {final Map<String, Seed> result = new HashMap<String, Seed>();while (s.hasNext() && count-- > 0) {@@ -509,6 +509,6 @@ public class PeerSelection {}}--++}\ No newline at end of filediff --git a/source/net/yacy/peers/operation/yacyVersion.java b/source/net/yacy/peers/operation/yacyVersion.javaindex df6227068..ba802026a 100644--- a/source/net/yacy/peers/operation/yacyVersion.java+++ b/source/net/yacy/peers/operation/yacyVersion.java@@ -9,11 +9,11 @@ import net.yacy.search.Switchboard;public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVersion> {- public static final float YACY_SUPPORTS_PORT_FORWARDING = (float) 0.383;- public static final float YACY_SUPPORTS_GZIP_POST_REQUESTS_CHUNKED = (float) 0.58204761;- public static final float YACY_HANDLES_COLLECTION_INDEX = (float) 0.486;- public static final float YACY_POVIDES_REMOTECRAWL_LISTS = (float) 0.550;- public static final float YACY_STANDARDREL_IS_PRO = (float) 0.557;+ public static final double YACY_SUPPORTS_PORT_FORWARDING = (float) 0.383;+ public static final double YACY_SUPPORTS_GZIP_POST_REQUESTS_CHUNKED = (float) 0.58204761;+ public static final double YACY_HANDLES_COLLECTION_INDEX = (float) 0.486;+ public static final double YACY_POVIDES_REMOTECRAWL_LISTS = (float) 0.550;+ public static final double YACY_STANDARDREL_IS_PRO = (float) 0.557;private static yacyVersion thisVersion = null;/**@@ -99,6 +99,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers* returns 0 if this object is equal to the obj, -1 if this is smaller* than obj and 1 if this is greater than obj*/+ @Overridepublic int compareTo(final yacyVersion obj) {return compare(this, obj);}@@ -108,6 +109,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers* must be implemented to make it possible to put this object into* a ordered structure, like TreeSet or TreeMap*/+ @Overridepublic int compare(final yacyVersion v0, final yacyVersion v1) {int r = (Float.valueOf(v0.getReleaseNr())).compareTo(Float.valueOf(v1.getReleaseNr()));if (r != 0) return r;@@ -116,6 +118,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVersreturn (Integer.valueOf(v0.getSvn())).compareTo(Integer.valueOf(v1.getSvn()));}+ @Overridepublic boolean equals(final Object obj) {if (obj instanceof yacyVersion) {final yacyVersion v = (yacyVersion) obj;@@ -124,6 +127,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVersreturn false;}+ @Overridepublic int hashCode() {return getName().hashCode();}@@ -137,21 +141,21 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers* If the major version is >= 0.11 - major version is replaced by "dev" and separated SVN-version by '/', e.g."dev/01818" <br>* "dev/00000" - If the input does not matcht the regular expression above*/- public static String combined2prettyVersion(final String ver) {+ public static String[] combined2prettyVersion(final String ver) {return combined2prettyVersion(ver, "");}- public static String combined2prettyVersion(final String ver, final String computerName) {+ public static String[] combined2prettyVersion(final String ver, final String computerName) {final Matcher matcher = yacyBuildProperties.versionMatcher.matcher(ver);if (!matcher.find()) {Log.logWarning("STARTUP", "Peer '"+computerName+"': wrong format of version-string: '" + ver + "'. Using default string 'dev/00000' instead");- return "dev/00000";+ return new String[]{"dev", "0000"};}final String mainversion = (Float.parseFloat(matcher.group(1)) < 0.11 ? "dev" : matcher.group(1));String revision = matcher.group(2);for(int i=revision.length();i<5;++i) revision += "0";- return mainversion+"/"+revision;+ return new String[]{mainversion, revision};}public static int revision(final String ver) {