- fixes to node identification

- added link to node in network list
- added marking of portal search node peers
pull/1/head
Michael Peter Christen 13 years ago
parent d1e9fe3db5
commit 71c3163f3d

@ -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)# #(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)# #(isCrawling)#::<a href="#[page]#"><img src="/env/grafics/crawl.gif" width="54" height="11" alt="Crawl" /></a>#(/isCrawling)#
</td> </td>
<td><a href="http://www.#[fullname]#.yacy">#[shortname]#</a></td> <td #(special)#::class="TableCellActive"#(/special)#><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 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">#[version]#</td>
<td align="right">#[ppm]#</td> <td align="right">#[ppm]#</td>
<td align="right">#[qph]#</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>
<tr class="TableCellDark"> <tr class="TableCellDark">
<td>#[my-name]#</td> <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-version]#</td>
<td align="right">#[my-utc]#</td> <td align="right">#[my-utc]#</td>
<td align="right">#[my-uptime]#</td> <td align="right">#[my-uptime]#</td>

@ -120,7 +120,7 @@ public class Network {
} }
prop.put("table_my-acceptcrawl", seed.getFlagAcceptRemoteCrawl() ? 1 : 0); prop.put("table_my-acceptcrawl", seed.getFlagAcceptRemoteCrawl() ? 1 : 0);
prop.put("table_my-dhtreceive", seed.getFlagAcceptRemoteIndex() ? 1 : 0); prop.put("table_my-dhtreceive", seed.getFlagAcceptRemoteIndex() ? 1 : 0);
prop.put("table_my-nodestate", seed.getFlagRootNode() ? 1 : 0);
myppm = sb.currentPPM(); myppm = sb.currentPPM();
myqph = 60d * sb.averageQPM(); 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 + "_shortname", shortname);
prop.putHTML(STR_TABLE_LIST + conCount + "_fullname", seed.get(Seed.NAME, "deadlink")); 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; userAgent = null;
if (seed.hash != null && seed.hash.equals(sb.peers.mySeed().hash)) { if (seed.hash != null && seed.hash.equals(sb.peers.mySeed().hash)) {
userAgent = ClientIdentification.getUserAgent(); 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 + "_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()) { if (seed.getFlagAcceptRemoteIndex()) {
prop.put(STR_TABLE_LIST + conCount + "_dhtreceive_peertags", ""); prop.put(STR_TABLE_LIST + conCount + "_dhtreceive_peertags", "");
} else { } else {
final String peertags = MapTools.set2string(seed.getPeerTags(), ",", false); 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 + "_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.putNum(STR_TABLE_LIST + conCount + "_lastSeen", /*seed.getLastSeenString() + " " +*/ lastseen);
prop.put(STR_TABLE_LIST + conCount + "_utc", seed.get(Seed.UTC, "-")); 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))); prop.putHTML(STR_TABLE_LIST + conCount + "_uptime", PeerActions.formatInterval(60000 * seed.getLong(Seed.UPTIME, 0)));

@ -36,7 +36,6 @@ import net.yacy.peers.Seed;
import net.yacy.peers.operation.yacyVersion; import net.yacy.peers.operation.yacyVersion;
import net.yacy.search.Switchboard; import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants; import net.yacy.search.SwitchboardConstants;
import de.anomic.data.WorkTables; import de.anomic.data.WorkTables;
import de.anomic.server.serverObjects; import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch; import de.anomic.server.serverSwitch;
@ -116,7 +115,8 @@ public class RemoteCrawl_p {
prop.putHTML(STR_TABLE_LIST + conCount + "_shortname", shortname); prop.putHTML(STR_TABLE_LIST + conCount + "_shortname", shortname);
prop.putHTML(STR_TABLE_LIST + conCount + "_fullname", seed.get(Seed.NAME, "deadlink")); prop.putHTML(STR_TABLE_LIST + conCount + "_fullname", seed.get(Seed.NAME, "deadlink"));
prop.put(STR_TABLE_LIST + conCount + "_age", seed.getAge()); 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.putNum(STR_TABLE_LIST + conCount + "_lastSeen", /*seed.getLastSeenString() + " " +*/ lastseen);
prop.put(STR_TABLE_LIST + conCount + "_utc", seed.get(Seed.UTC, "-")); 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))); prop.putHTML(STR_TABLE_LIST + conCount + "_uptime", PeerActions.formatInterval(60000 * seed.getLong(Seed.UPTIME, 0L)));

@ -37,9 +37,9 @@ import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.HeaderFramework; import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.logging.Log; 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.Network;
import net.yacy.peers.Protocol;
import net.yacy.peers.Seed;
import net.yacy.peers.dht.PeerSelection; import net.yacy.peers.dht.PeerSelection;
import net.yacy.peers.graphics.ProfilingGraph; import net.yacy.peers.graphics.ProfilingGraph;
import net.yacy.peers.operation.yacyVersion; 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 userAgent = header.get(HeaderFramework.USER_AGENT, "<unknown>");
final String reportedip = remoteSeed.getIP(); final String reportedip = remoteSeed.getIP();
final String reportedPeerType = remoteSeed.get(Seed.PEERTYPE, Seed.PEERTYPE_JUNIOR); 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 (sb.isRobinsonMode() && !sb.isPublicRobinson()) {
// if we are a robinson cluster, answer only if this client is known by our network definition // if we are a robinson cluster, answer only if this client is known by our network definition

@ -539,11 +539,11 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>
* @return the YaCy version of this peer as a float or <code>0</code> if no valid value could be retrieved * @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 * from this yacySeed object
*/ */
public final float getVersion() { public final Double getVersion() {
try { try {
return Float.parseFloat(get(Seed.VERSION, Seed.ZERO)); return Double.parseDouble(get(Seed.VERSION, Seed.ZERO));
} catch ( final NumberFormatException e ) { } catch ( final NumberFormatException e ) {
return 0; return 0.0d;
} }
} }
@ -771,21 +771,23 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>
} }
public final boolean getFlagDirectConnect() { public final boolean getFlagDirectConnect() {
return getFlag(0); return getFlag(FLAG_DIRECT_CONNECT);
} }
public final boolean getFlagAcceptRemoteCrawl() { public final boolean getFlagAcceptRemoteCrawl() {
//if (getVersion() < 0.300) return false; //if (getVersion() < 0.300) return false;
//if (getVersion() < 0.334) return true; //if (getVersion() < 0.334) return true;
return getFlag(1); return getFlag(FLAG_ACCEPT_REMOTE_CRAWL);
} }
public final boolean getFlagAcceptRemoteIndex() { public final boolean getFlagAcceptRemoteIndex() {
//if (getVersion() < 0.335) return false; //if (getVersion() < 0.335) return false;
return getFlag(2); return getFlag(FLAG_ACCEPT_REMOTE_INDEX);
} }
public final boolean getFlagRootNode() { public final boolean getFlagRootNode() {
double v = getVersion();
if (v < 1.02009142d) return false;
return getFlag(FLAG_ROOT_NODE); return getFlag(FLAG_ROOT_NODE);
} }

@ -413,17 +413,17 @@ public final class SeedDB implements AlternativeDomainNames {
return clustermap; 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 order // enumerates seed-type objects: all seeds sequentially without order
return new seedEnum(up, rot, (firstHash == null) ? null : firstHash, null, this.seedActiveDB, minVersion); return 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 order // enumerates seed-type objects: all seeds sequentially without order
return new seedEnum(up, rot, (firstHash == null) ? null : firstHash, null, this.seedPassiveDB, minVersion); return 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 number // return just any seed that has a specific minimum version number
final Iterator<Seed> e = seedsConnected(true, true, Seed.randomHash(), minVersion); final Iterator<Seed> e = seedsConnected(true, true, Seed.randomHash(), minVersion);
return e.next(); return e.next();
@ -938,14 +938,14 @@ public final class SeedDB implements AlternativeDomainNames {
private Iterator<Map.Entry<byte[], Map<String, String>>> it; private Iterator<Map.Entry<byte[], Map<String, String>>> it;
private Seed nextSeed; private Seed nextSeed;
private final MapDataMining database; 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.database = database;
this.minVersion = minVersion; this.minVersion = minVersion;
try { try {
this.it = (firstKey == null) ? database.entries(up, rot) : database.entries(up, rot, firstKey, secondKey); this.it = (firstKey == null) ? database.entries(up, rot) : database.entries(up, rot, firstKey, secondKey);
float version; double version;
while (true) { while (true) {
this.nextSeed = internalNext(); this.nextSeed = internalNext();
if (this.nextSeed == null) break; if (this.nextSeed == null) break;
@ -1023,7 +1023,7 @@ public final class SeedDB implements AlternativeDomainNames {
public Seed next() { public Seed next() {
final Seed seed = this.nextSeed; final Seed seed = this.nextSeed;
float version; double version;
try {while (true) { try {while (true) {
this.nextSeed = internalNext(); this.nextSeed = internalNext();
if (this.nextSeed == null) break; if (this.nextSeed == null) break;

@ -299,12 +299,12 @@ public class PeerSelection {
* @param minVersion * @param minVersion
* @return * @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/beginning // enumerates seed-type objects: all seeds with starting point in the middle, rotating at the end/beginning
return new seedDHTEnum(seedDB, firstHash, minVersion, false); return 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/beginning // enumerates seed-type objects: all seeds with starting point in the middle, rotating at the end/beginning
return new seedDHTEnum(seedDB, firstHash, minVersion, alsoMyOwn); return new seedDHTEnum(seedDB, firstHash, minVersion, alsoMyOwn);
} }
@ -312,13 +312,13 @@ public class PeerSelection {
private Iterator<Seed> e; private Iterator<Seed> e;
private int steps; private int steps;
private final float minVersion; private final double minVersion;
private final SeedDB seedDB; private final SeedDB seedDB;
private boolean alsoMyOwn; private boolean alsoMyOwn;
private int pass, insertOwnInPass; private int pass, insertOwnInPass;
private Seed nextSeed; 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.seedDB = seedDB;
this.steps = seedDB.sizeConnected() + ((alsoMyOwn) ? 1 : 0); this.steps = seedDB.sizeConnected() + ((alsoMyOwn) ? 1 : 0);
this.minVersion = minVersion; this.minVersion = minVersion;

@ -9,11 +9,11 @@ import net.yacy.search.Switchboard;
public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVersion> { public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVersion> {
public static final float YACY_SUPPORTS_PORT_FORWARDING = (float) 0.383; public static final double YACY_SUPPORTS_PORT_FORWARDING = (float) 0.383;
public static final float YACY_SUPPORTS_GZIP_POST_REQUESTS_CHUNKED = (float) 0.58204761; public static final double YACY_SUPPORTS_GZIP_POST_REQUESTS_CHUNKED = (float) 0.58204761;
public static final float YACY_HANDLES_COLLECTION_INDEX = (float) 0.486; public static final double YACY_HANDLES_COLLECTION_INDEX = (float) 0.486;
public static final float YACY_POVIDES_REMOTECRAWL_LISTS = (float) 0.550; public static final double YACY_POVIDES_REMOTECRAWL_LISTS = (float) 0.550;
public static final float YACY_STANDARDREL_IS_PRO = (float) 0.557; public static final double YACY_STANDARDREL_IS_PRO = (float) 0.557;
private static yacyVersion thisVersion = null; 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 * 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 * than obj and 1 if this is greater than obj
*/ */
@Override
public int compareTo(final yacyVersion obj) { public int compareTo(final yacyVersion obj) {
return compare(this, 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 * must be implemented to make it possible to put this object into
* a ordered structure, like TreeSet or TreeMap * a ordered structure, like TreeSet or TreeMap
*/ */
@Override
public int compare(final yacyVersion v0, final yacyVersion v1) { public int compare(final yacyVersion v0, final yacyVersion v1) {
int r = (Float.valueOf(v0.getReleaseNr())).compareTo(Float.valueOf(v1.getReleaseNr())); int r = (Float.valueOf(v0.getReleaseNr())).compareTo(Float.valueOf(v1.getReleaseNr()));
if (r != 0) return r; if (r != 0) return r;
@ -116,6 +118,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
return (Integer.valueOf(v0.getSvn())).compareTo(Integer.valueOf(v1.getSvn())); return (Integer.valueOf(v0.getSvn())).compareTo(Integer.valueOf(v1.getSvn()));
} }
@Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
if (obj instanceof yacyVersion) { if (obj instanceof yacyVersion) {
final yacyVersion v = (yacyVersion) obj; final yacyVersion v = (yacyVersion) obj;
@ -124,6 +127,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
return false; return false;
} }
@Override
public int hashCode() { public int hashCode() {
return getName().hashCode(); return getName().hashCode();
} }
@ -137,21 +141,21 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
* If the major version is &gt;= 0.11 - major version is replaced by "dev" and separated SVN-version by '/', e.g."dev/01818" <br> * If the major version is &gt;= 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 * "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, ""); 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); final Matcher matcher = yacyBuildProperties.versionMatcher.matcher(ver);
if (!matcher.find()) { if (!matcher.find()) {
Log.logWarning("STARTUP", "Peer '"+computerName+"': wrong format of version-string: '" + ver + "'. Using default string 'dev/00000' instead"); 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)); final String mainversion = (Float.parseFloat(matcher.group(1)) < 0.11 ? "dev" : matcher.group(1));
String revision = matcher.group(2); String revision = matcher.group(2);
for(int i=revision.length();i<5;++i) revision += "0"; 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) { public static int revision(final String ver) {

Loading…
Cancel
Save