From 65e6ae52fb6df83920b6bb667a4486c0ca67e532 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Wed, 1 Oct 2014 03:10:39 +0200 Subject: [PATCH] IPv6-enhanced Network monitoring page --- htroot/Network.csv | 1 - htroot/Network.html | 65 ++++++------- htroot/Network.java | 62 +++++++----- htroot/Network.xml | 11 +-- .../{RootStateNo.gif => NodeDisqualified.gif} | Bin htroot/env/grafics/NodeDisqualifiedIPv4.gif | Bin 0 -> 95 bytes htroot/env/grafics/NodeDisqualifiedIPv6.gif | Bin 0 -> 94 bytes .../{RootStateYes.gif => NodeQualified.gif} | Bin htroot/env/grafics/NodeQualifiedIPv4.gif | Bin 0 -> 124 bytes htroot/env/grafics/NodeQualifiedIPv6.gif | Bin 0 -> 94 bytes source/net/yacy/peers/Network.java | 92 ++++-------------- source/net/yacy/peers/Protocol.java | 20 ++-- 12 files changed, 99 insertions(+), 152 deletions(-) delete mode 100644 htroot/Network.csv rename htroot/env/grafics/{RootStateNo.gif => NodeDisqualified.gif} (100%) create mode 100644 htroot/env/grafics/NodeDisqualifiedIPv4.gif create mode 100644 htroot/env/grafics/NodeDisqualifiedIPv6.gif rename htroot/env/grafics/{RootStateYes.gif => NodeQualified.gif} (100%) create mode 100644 htroot/env/grafics/NodeQualifiedIPv4.gif create mode 100644 htroot/env/grafics/NodeQualifiedIPv6.gif diff --git a/htroot/Network.csv b/htroot/Network.csv deleted file mode 100644 index edcd00696..000000000 --- a/htroot/Network.csv +++ /dev/null @@ -1 +0,0 @@ -#(table)#:: ::#[active-count]#;#[active-links]#;#[active-words]#;#[passive-count]#;#[passive-links]#;#[passive-words]#;#[potential-count]#;#[potential-links]#;#[potential-words]#;#[all-count]#;#[all-links]#;#[all-words]#;#[my-links]#;#[my-words]##(/table)# diff --git a/htroot/Network.html b/htroot/Network.html index a96c2888c..cc745c8d2 100644 --- a/htroot/Network.html +++ b/htroot/Network.html @@ -104,54 +104,43 @@ document.getElementById("apilink").setAttribute("href", "Network.xml?" + window. - + + + + - - - + + - + - #(complete)#:: - - - - - - - - #(/complete)# + + #(c)#::#(/c)# + #{list}# - - + + + #(type)##(direct)#Junior passive::Junior direct::Junior offline#(/direct)#::#(direct)#senior passive::Senior direct::Senior offline#(/direct)#::#(direct)#Principal passive::Principal active::Principal offline#(/direct)##(/type)##(acceptcrawl)#no crawl::crawl possible::crawl possible#(/acceptcrawl)##(dhtreceive)#no DHT receive::DHT receive enabled::DHT receive enabled#(/dhtreceive)##{ips}##{/ips}# + + + - @@ -160,16 +149,18 @@ document.getElementById("apilink").setAttribute("href", "Network.xml?" + window. - #(complete)# - :: - - - - - - - - #(/complete)# + + #(c)#::#(/c)# + #{/list}#
send Message/
show Profile/
edit Wiki/
browse Blog
Hash Name
Info ReleaseAge#Seedscon/h
PPM QPH Last
Seen
UTC
Offset
Location
Uptime Links RWIsURLs for
Remote
Crawl
Sent
DHT Word Chunks
URLs
for
Remote
Crawl
Sent DHT
Word Chunks
Sent
URLs
Received
DHT Word Chunks
Received DHT
Word Chunks
Received
URLs
AddressHashAge#Seedscon/h
user agent
Peer
Ping
Location
user agent
send Message/
show Profile/
edit Wiki/
browse Blog
- m  - p  - w  - b  - #(updatedProfile)#::Profile updated#(/updatedProfile)# - #(updatedWiki)#::Wiki updated#(/updatedWiki)# - #(updatedBlog)#::Blog updated#(/updatedBlog)# - #(isCrawling)#::Crawl#(/isCrawling)# - #[shortname]##(ssl)#::https supported#(/ssl)##[hash]##[shortname]##(ssl)#::https supported#(/ssl)# - #(type)##(direct)#Junior passive::Junior direct::Junior offline#(/direct)#::#(direct)#senior passive::Senior direct::Senior offline#(/direct)#::#(direct)#Principal passive::Principal active::Principal offline#(/direct)##(/type)##(acceptcrawl)#no crawl::crawl possible::crawl possible#(/acceptcrawl)##(dhtreceive)#no DHT receive::DHT receive enabled::DHT receive enabled#(/dhtreceive)##(nodestate)#no node candidate::node candidate#(/nodestate)# #[version]##[age]##[seeds]##[connects]# #[ppm]# #[qph]# #[lastSeen]# #[utc]##[location]# #[uptime]# #[LCount]# #[ICount]##[sU]# #[rI]# #[rU]#http://#[ip]#:#[port]# #[ips]##[hash]##[age]##[seeds]##[connects]##[userAgent]#[Ping]#[location]##[userAgent]# + m  + p  + w  + b  + #(updatedProfile)#::Profile updated#(/updatedProfile)# + #(updatedWiki)#::Wiki updated#(/updatedWiki)# + #(updatedBlog)#::Blog updated#(/updatedBlog)# + #(isCrawling)#::Crawl#(/isCrawling)# +
diff --git a/htroot/Network.java b/htroot/Network.java index 8b070dd22..38c5599cd 100644 --- a/htroot/Network.java +++ b/htroot/Network.java @@ -32,6 +32,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Locale; import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.regex.Matcher; @@ -210,19 +211,21 @@ public class Network { Seed peer = new Seed(post.get("peerHash"), map); sb.updateMySeed(); - final int added = Protocol.hello(sb.peers.mySeed(), sb.peers.peerActions, peer); + final Map response = Protocol.hello(sb.peers.mySeed(), sb.peers.peerActions, peer); - if (added <= 0) { + if (response == null) { prop.put("table_comment",1); - prop.putHTML("table_comment_status","publish: disconnected peer '" + peer.getName() + "/" + post.get("peerHash") + "' from " + peer.getIPs()); + prop.putHTML("table_comment_status","publish: no response from peer '" + peer.getName() + "/" + post.get("peerHash") + "' from " + peer.getIPs()); } else { + String yourtype = response.get("yourtype"); + String yourip = response.get("yourip"); peer = sb.peers.getConnected(peer.hash); if (peer == null) { prop.put("table_comment",1); - prop.putHTML("table_comment_status","publish: disconnected peer 'UNKNOWN/" + post.get("peerHash") + "' from UNKNOWN"); + prop.putHTML("table_comment_status","publish: disconnected peer 'UNKNOWN/" + post.get("peerHash") + "' from UNKNOWN, yourtype = " + yourtype + ", yourip = " + yourip); } else { prop.put("table_comment",2); - prop.putHTML("table_comment_status","publish: handshaked " + peer.get(Seed.PEERTYPE, Seed.PEERTYPE_SENIOR) + " peer '" + peer.getName() + "' at " + peer.getIPs()); + prop.putHTML("table_comment_status","publish: handshaked " + peer.get(Seed.PEERTYPE, Seed.PEERTYPE_SENIOR) + " peer '" + peer.getName() + "' at " + peer.getIPs() +", yourtype = " + yourtype + ", yourip = " + yourip); prop.putHTML("table_comment_details",peer.toString()); } } @@ -285,7 +288,7 @@ public class Network { boolean dark = true; Seed seed; - final boolean complete = (post != null && post.containsKey("ip")); + final boolean c = (post != null && post.containsKey("ip")); final boolean onlyIncomingDHT = (post != null && post.containsKey("onlydhtin")); final boolean onlyNode = (post != null && post.containsKey("onlynode")); final long onlyAgeOverDays = post == null ? 0 : post.getLong("onlyageoverdays", 0); @@ -341,6 +344,7 @@ public class Network { prop.put(STR_TABLE_LIST + conCount + "_updatedWikiPage", 0); prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 0); prop.put(STR_TABLE_LIST + conCount + "_isCrawling", 0); + String ip = seed.getIP(); if (conCount >= maxCount) { break; } if (sb.peers != null && sb.peers.mySeed() != null && seed.hash != null && seed.hash.equals(sb.peers.mySeed().hash)) { prop.put(STR_TABLE_LIST + conCount + "_dark", 2); @@ -356,7 +360,7 @@ public class Network { } else { prop.put(STR_TABLE_LIST + conCount + "_updatedWiki", 1); prop.putHTML(STR_TABLE_LIST + conCount + "_updatedWiki_page", wikiMap.get("page")); - prop.put(STR_TABLE_LIST + conCount + "_updatedWiki_address", seed.getPublicAddress()); + prop.put(STR_TABLE_LIST + conCount + "_updatedWiki_address", seed.getPublicAddress(ip)); } if ((blogMap = updatedBlog.get(seed.hash)) == null) { prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 0); @@ -364,7 +368,7 @@ public class Network { prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 1); prop.putHTML(STR_TABLE_LIST + conCount + "_updatedBlog_page", blogMap.get("page")); prop.putHTML(STR_TABLE_LIST + conCount + "_updatedBlog_subject", blogMap.get("subject")); - prop.put(STR_TABLE_LIST + conCount + "_updatedBlog_address", seed.getPublicAddress()); + prop.put(STR_TABLE_LIST + conCount + "_updatedBlog_address", seed.getPublicAddress(ip)); } PPM = seed.getPPM(); QPM = seed.getQPM(); @@ -386,30 +390,39 @@ public class Network { userAgent = ClientIdentification.yacyInternetCrawlerAgent.userAgent; location = ClientIdentification.generateLocation(); } else { - userAgent = sb.peers.peerActions.getUserAgent(seed.getIP()); + userAgent = sb.peers.peerActions.getUserAgent(ip); location = ClientIdentification.parseLocationInUserAgent(userAgent); } if (location.length() > 10) location = location.substring(0, 10); if (location.length() == 0) { - Locale l = Domains.getLocale(seed.getIP()); + Locale l = Domains.getLocale(ip); if (l != null) location = l.toString(); } prop.putHTML(STR_TABLE_LIST + conCount + "_location", location); - if (complete) { - prop.put(STR_TABLE_LIST + conCount + "_complete", 1); - prop.putHTML(STR_TABLE_LIST + conCount + "_complete_ip", seed.getIP() ); - prop.putHTML(STR_TABLE_LIST + conCount + "_complete_ips", seed.getIPs().toString() ); - prop.put(STR_TABLE_LIST + conCount + "_complete_port", seed.get(Seed.PORT, "-") ); - prop.put(STR_TABLE_LIST + conCount + "_complete_hash", seed.hash); - prop.put(STR_TABLE_LIST + conCount + "_complete_age", seed.getAge()); - prop.putNum(STR_TABLE_LIST + conCount + "_complete_seeds", seed.getLong(Seed.SCOUNT, 0L)); - prop.putNum(STR_TABLE_LIST + conCount + "_complete_connects", seed.getFloat(Seed.CCOUNT, 0F)); - prop.putHTML(STR_TABLE_LIST + conCount + "_complete_userAgent", userAgent); + String port = seed.get(Seed.PORT, "-"); + Set ips = seed.getIPs(); + int ipsc = 0; + for (String s: ips) { + prop.put(STR_TABLE_LIST + conCount + "_ips_" + ipsc + "_nodestate", seed.getFlagRootNode() ? 1 : 0); + prop.put(STR_TABLE_LIST + conCount + "_ips_" + ipsc + "_c", c ? 1 : 0); + prop.putHTML(STR_TABLE_LIST + conCount + "_ips_" + ipsc + "_c_hash", seed.hash); + prop.putHTML(STR_TABLE_LIST + conCount + "_ips_" + ipsc + "_c_ip", s); + prop.putHTML(STR_TABLE_LIST + conCount + "_ips_" + ipsc + "_c_port", port); + prop.put(STR_TABLE_LIST + conCount + "_ips_" + ipsc++ + "_c_ipv6", s.indexOf(':') >= 0 ? 1 : 0); + } + prop.put(STR_TABLE_LIST + conCount + "_ips", ipsc); + prop.put(STR_TABLE_LIST + conCount + "_port", port); + prop.put(STR_TABLE_LIST + conCount + "_hash", seed.hash); + prop.put(STR_TABLE_LIST + conCount + "_age", seed.getAge()); + prop.putNum(STR_TABLE_LIST + conCount + "_seeds", seed.getLong(Seed.SCOUNT, 0L)); + prop.putNum(STR_TABLE_LIST + conCount + "_connects", seed.getFloat(Seed.CCOUNT, 0F)); + if (c) { + prop.put(STR_TABLE_LIST + conCount + "_c", 1); + prop.putHTML(STR_TABLE_LIST + conCount + "_c_userAgent", userAgent); } else { - prop.put(STR_TABLE_LIST + conCount + "_complete", 0); + prop.put(STR_TABLE_LIST + conCount + "_c", 0); } - if (seed.isJunior()) { prop.put(STR_TABLE_LIST + conCount + "_type", 0); } else if(seed.isSenior()){ @@ -447,9 +460,6 @@ 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() ? 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 { @@ -479,7 +489,7 @@ public class Network { prop.put("table", 1); prop.putNum("table_num", conCount); prop.putNum("table_total", ((page == 1) && (iAmActive)) ? (size + 1) : size ); - prop.put("table_complete", ((complete)? 1 : 0) ); + prop.put("table_c", ((c)? 1 : 0) ); } } prop.put("page", page); diff --git a/htroot/Network.xml b/htroot/Network.xml index eb7d0838f..a01561ea5 100644 --- a/htroot/Network.xml +++ b/htroot/Network.xml @@ -21,17 +21,16 @@ #(type_direct)#direct::passive#(/type_direct)# #[acceptcrawl]# #[dhtreceive]# - #[nodestate]# + #(nodestate)#false::true#(/nodestate)# #[location]# #[type_url]# - #(complete)# - :: #[age]# #[seeds]# #[connects]# -
#[ip]#:#[port]#
- #[userAgent]# - #(/complete)# + #{ips}##(c)##[ip]#::#[ip]##(/c)##{/ips}# + #{ips}#
#(c)##(ipv6)#::[#(/ipv6)##[ip]##(ipv6)#::]#(/ipv6)#:#[port]#::#(/c)#
#{/ips}# + #[port]# + #(c)#::#[userAgent]##(/c)# #{/list}# :: diff --git a/htroot/env/grafics/RootStateNo.gif b/htroot/env/grafics/NodeDisqualified.gif similarity index 100% rename from htroot/env/grafics/RootStateNo.gif rename to htroot/env/grafics/NodeDisqualified.gif diff --git a/htroot/env/grafics/NodeDisqualifiedIPv4.gif b/htroot/env/grafics/NodeDisqualifiedIPv4.gif new file mode 100644 index 0000000000000000000000000000000000000000..1b2921e4d2c954caa4019cb60d846445ed0ec267 GIT binary patch literal 95 zcmZ?wbhEHb#e6&5G_v$9+zdj(!v$McnyLP5Y*mjxuOrO(ylGNjrr;Fjl0{z+w3#wUzh;~~&sFWX??eU$YXFR~Bnbcj literal 0 HcmV?d00001 diff --git a/htroot/env/grafics/RootStateYes.gif b/htroot/env/grafics/NodeQualified.gif similarity index 100% rename from htroot/env/grafics/RootStateYes.gif rename to htroot/env/grafics/NodeQualified.gif diff --git a/htroot/env/grafics/NodeQualifiedIPv4.gif b/htroot/env/grafics/NodeQualifiedIPv4.gif new file mode 100644 index 0000000000000000000000000000000000000000..8da5bb63fbc8d99f5dc3dbd4baa971f4866a7d54 GIT binary patch literal 124 zcmZ?wbhEHbn1B;=-iNrq1O)P~1Ob--2?y@tT5af}|sA~CmZtCqtD+}K}IQqWD V;pMbR1vY9EU4%BXs0uPz0{~t?EHeNA literal 0 HcmV?d00001 diff --git a/htroot/env/grafics/NodeQualifiedIPv6.gif b/htroot/env/grafics/NodeQualifiedIPv6.gif new file mode 100644 index 0000000000000000000000000000000000000000..556914c1bd4f524c238c51f2ae084917b7f295e7 GIT binary patch literal 94 zcmZ?wbhEHb7UYze-t 0 ) { - log.info("received " - + newSeeds - + " new peer(s), know a total of " - + this.sb.peers.sizeConnected() - + " different peers"); - } + publishMySeed(false); } // use our own formatter to prevent concurrency locks with other processes @@ -202,7 +195,7 @@ public class Network protected class publishThread extends Thread { - int added; + private Map result; private final Seed seed; private final Semaphore sync; private final List syncList; @@ -219,14 +212,14 @@ public class Network this.syncList = syncList; this.seed = seed; - this.added = 0; + this.result = null; } @Override public final void run() { try { - this.added = Protocol.hello(Network.this.sb.peers.mySeed(), Network.this.sb.peers.peerActions, this.seed); - if ( this.added < 0 ) { + this.result = Protocol.hello(Network.this.sb.peers.mySeed(), Network.this.sb.peers.peerActions, this.seed); + if ( this.result == null ) { // no or wrong response, delete that address final String cause = "peer ping to peer resulted in error response (added < 0)"; log.info("publish: disconnected " @@ -324,7 +317,7 @@ public class Network } } - private int publishMySeed(final boolean force) { + private boolean publishMySeed(final boolean force) { try { // call this after the httpd was started up @@ -349,9 +342,7 @@ public class Network // getting a list of peers to contact if ( this.sb.peers.mySeed().get(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN).equals(Seed.PEERTYPE_VIRGIN) ) { - if ( attempts > PING_INITIAL ) { - attempts = PING_INITIAL; - } + if (attempts > PING_INITIAL) attempts = PING_INITIAL; final Set ch = Switchboard.getSwitchboard().clusterhashes; seeds = DHTSelection.seedsByAge(this.sb.peers, true, attempts - ((ch == null) ? 0 : ch.size())); // best for fast connection // add also all peers from cluster if this is a public robinson cluster @@ -363,9 +354,7 @@ public class Network seed = seeds.get(hash); if (seed == null) { seed = this.sb.peers.get(hash); - if ( seed == null ) { - continue; - } + if (seed == null) continue; } seeds.put(hash, seed); } @@ -385,12 +374,8 @@ public class Network seeds = DHTSelection.seedsByAge(this.sb.peers, false, attempts); // best for seed list maintenance/cleaning } - if ( seeds == null || seeds.isEmpty() ) { - return 0; - } - if ( seeds.size() < attempts ) { - attempts = seeds.size(); - } + if (seeds == null || seeds.isEmpty()) return false; + if (seeds.size() < attempts) attempts = seeds.size(); // This will try to get Peers that are not currently in amIAccessibleDB final Iterator si = seeds.values().iterator(); @@ -408,14 +393,13 @@ public class Network log.severe("publishMySeed: problem with news encoding", e); } this.sb.peers.mySeed().setUnusedFlags(); - int newSeeds = -1; //if (seeds.length > 1) { // holding a reference to all started threads int contactedSeedCount = 0; final List syncList = Collections.synchronizedList(new LinkedList()); // memory for threads final Semaphore sync = new Semaphore(attempts); - // going through the peer list and starting a new publisher thread for each peer + // go through the peer list and starting a new publisher thread for each peer int i = 0; while ( si.hasNext() ) { seed = si.next(); @@ -426,9 +410,7 @@ public class Network i++; final String address = seed.getPublicAddress(seed.getIP()); - if ( log.isFine() ) { - log.fine("HELLO #" + i + " to peer '" + seed.get(Seed.NAME, "") + "' at " + address); // debug - } + if ( log.isFine() ) log.fine("HELLO #" + i + " to peer '" + seed.get(Seed.NAME, "") + "' at " + address); // debug final String seederror = seed.isProper(false); if ( (address == null) || (seederror != null) ) { // we don't like that address, delete it @@ -456,15 +438,6 @@ public class Network // getting a reference to the finished thread final publishThread t = (publishThread) syncList.remove(0); - - // getting the amount of new reported seeds - if ( t.added >= 0 ) { - if ( newSeeds == -1 ) { - newSeeds = t.added; - } else { - newSeeds += t.added; - } - } } int accessible = 0; @@ -486,19 +459,9 @@ public class Network } } } - if ( log.isFine() ) { - log - .fine("DBSize before -> after Cleanup: " - + dbSize - + " -> " - + amIAccessibleDB.size()); - } + if (log.isFine()) log.fine("DBSize before -> after Cleanup: " + dbSize + " -> " + amIAccessibleDB.size()); } - log.info("PeerPing: I am accessible for " - + accessible - + " peer(s), not accessible for " - + notaccessible - + " peer(s)."); + log.info("PeerPing: I am accessible for " + accessible + " peer(s), not accessible for " + notaccessible + " peer(s)."); if ( (accessible + notaccessible) > 0 ) { final String newPeerType; @@ -517,11 +480,7 @@ public class Network if ( this.sb.peers.mySeed().orVirgin().equals(newPeerType) ) { log.info("PeerPing: myType is " + this.sb.peers.mySeed().orVirgin()); } else { - log.info("PeerPing: changing myType from '" - + this.sb.peers.mySeed().orVirgin() - + "' to '" - + newPeerType - + "'"); + log.info("PeerPing: changing myType from '" + this.sb.peers.mySeed().orVirgin() + "' to '" + newPeerType + "'"); this.sb.peers.mySeed().put(Seed.PEERTYPE, newPeerType); } } else { @@ -534,20 +493,11 @@ public class Network this.sb.peers.saveMySeed(); // if we have an address, we do nothing - if ( this.sb.peers.mySeed().isProper(true) == null && !force ) { - return 0; - } - if ( newSeeds > 0 ) { - return newSeeds; - } + if (this.sb.peers.mySeed().isProper(true) == null) return true; - // still no success: ask own NAT or internet responder - //final boolean DI604use = switchboard.getConfig("DI604use", "false").equals("true"); - //final String DI604pw = switchboard.getConfig("DI604pw", ""); + // still no success final String ip = this.sb.getConfig("staticIP", ""); - //if (ip.equals("")) ip = natLib.retrieveIP(DI604use, DI604pw); - // yacyCore.log.logDebug("DEBUG: new IP=" + ip); if (Seed.isProperIP(ip)) { this.sb.peers.mySeed().setIP(ip); } @@ -556,7 +506,7 @@ public class Network } log.info("publish: no recipient found, our address is " + this.sb.peers.mySeed().getIPs()); this.sb.peers.saveMySeed(); - return 0; + return false; } catch (final InterruptedException e ) { try { log.info("publish: Interruption detected while publishing my seed."); @@ -606,12 +556,10 @@ public class Network log.info("publish: Shutdown off all remaining publishing thread finished."); } catch (final Exception ee ) { - log.warn( - "publish: Unexpected error while trying to shutdown all remaining publishing threads.", - e); + log.warn("publish: Unexpected error while trying to shutdown all remaining publishing threads.", e); } - return 0; + return false; } } diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.java index e2a79fa6a..03f885fdf 100644 --- a/source/net/yacy/peers/Protocol.java +++ b/source/net/yacy/peers/Protocol.java @@ -167,7 +167,7 @@ public final class Protocol { * * @return the number of new seeds */ - public static int hello( + public static Map hello( final Seed mySeed, final PeerActions peerActions, final Seed otherSeed) { @@ -201,7 +201,7 @@ public final class Protocol { Network.log.info("yacyClient.hello thread '" + Thread.currentThread().getName() + "' interrupted."); - return -1; + return null; } Network.log.info("yacyClient.hello thread '" + Thread.currentThread().getName() + "', peer " + address + "; exception: " + e.getMessage()); // try again (go into loop) @@ -211,7 +211,7 @@ public final class Protocol { if (result == null || result.size() == 0) { Network.log.info("yacyClient.hello result error: " + ((result == null) ? "result null" : ("result=" + result.toString()))); - return -1; + return null; } Network.log.info("yacyClient.hello thread '" + Thread.currentThread().getName() @@ -233,7 +233,7 @@ public final class Protocol { try { // patch the remote peer address to avoid that remote peers spoof the network with wrong addresses final int p = address.lastIndexOf(':'); - if ( p < 0 ) return -1; + if ( p < 0 ) return null; String h = address.substring(0, p); if (h.charAt(0) == '[') h = h.substring(1); if (h.charAt(h.length() - 1) == ']') h = h.substring(0, h.length() - 1); @@ -241,11 +241,11 @@ public final class Protocol { otherPeer = Seed.genRemoteSeed(seed, false, ie.getHostAddress()); if ( !otherPeer.hash.equals(otherSeed.hash) ) { Network.log.info("yacyClient.hello: consistency error: otherPeer.hash = " + otherPeer.hash + ", otherHash = " + otherSeed.hash); - return -1; // no success + return null; // no success } } catch (final IOException e ) { Network.log.info("yacyClient.hello: consistency error: other seed bad:" + e.getMessage() + ", seed=" + seed); - return -1; // no success + return null; // no success } } } @@ -313,7 +313,7 @@ public final class Protocol { + mytype + ", rejecting other peer."); } - return -1; + return null; } if ( mySeed.orVirgin().equals(Seed.PEERTYPE_VIRGIN) ) { mySeed.put(Seed.PEERTYPE, mytype); @@ -322,7 +322,7 @@ public final class Protocol { final String error = mySeed.isProper(true); if ( error != null ) { Network.log.warn("yacyClient.hello mySeed error - not proper: " + error); - return -1; + return null; } //final Date remoteTime = yacyCore.parseUniversalDate((String) result.get(yacySeed.MYTIME)); // read remote time @@ -347,7 +347,7 @@ public final class Protocol { if ( i == 1 ) { final int p = address.indexOf(':'); if ( p < 0 ) { - return -1; + return null; } InetAddress ia = Domains.dnsResolve(address.substring(0, p)); if (ia == null) continue; @@ -371,7 +371,7 @@ public final class Protocol { // update event tracker EventTracker.update(EventTracker.EClass.PEERPING, new ProfilingGraph.EventPing(mySeed.getName(), otherSeed.getName(), true, connectedAfter - connectedBefore), false); - return count; + return result; } public static Seed querySeed(final Seed target, final String seedHash) {