IPv6-enhanced Network monitoring page

pull/1/head
Michael Peter Christen 10 years ago
parent 7c1707872b
commit 65e6ae52fb

@ -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)#
1 #(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)#

@ -104,54 +104,43 @@ document.getElementById("apilink").setAttribute("href", "Network.xml?" + window.
</form> </form>
<table class="sortable" border="0"> <table class="sortable" border="0">
<tr class="TableHeader" valign="bottom"> <tr class="TableHeader" valign="bottom">
<td>send&nbsp;<strong>M</strong>essage/<br/>show&nbsp;<strong>P</strong>rofile/<br/>edit&nbsp;<strong>W</strong>iki/<br/>browse&nbsp;<strong>B</strong>log</td> <td><strong>Hash</strong></td>
<td><strong>Name</strong><br/></td> <td><strong>Name</strong><br/></td>
<td width="34"><strong>Info</strong></td> <td width="34"><strong>Info</strong></td>
<td><strong>Release</strong></td> <td><strong>Release</strong></td>
<td><strong>Age</strong></td>
<td><strong>#Seeds</strong></td>
<td><strong>con/h<br/></strong></td>
<td><strong>PPM</strong></td> <td><strong>PPM</strong></td>
<td><strong>QPH</strong></td> <td><strong>QPH</strong></td>
<td><strong>Last<br/>Seen</strong></td> <td><strong>Last<br/>Seen</strong></td>
<td><strong>UTC</strong><br/>Offset</td> <td><strong>UTC</strong><br/>Offset</td>
<td><strong>Location</strong><br/></td>
<td style="width:70px;"><strong>Uptime</strong></td> <td style="width:70px;"><strong>Uptime</strong></td>
<td><strong>Links</strong></td> <td><strong>Links</strong></td>
<td><strong>RWIs</strong></td> <td><strong>RWIs</strong></td>
<td><strong>URLs for<br/>Remote<br/>Crawl</strong></td> <td><strong>URLs<br/>for<br/>Remote<br/>Crawl</strong></td>
<td><strong>Sent<br/>DHT Word Chunks</strong></td> <td><strong>Sent DHT<br/>Word Chunks</strong></td>
<td><strong>Sent<br/>URLs</strong></td> <td><strong>Sent<br/>URLs</strong></td>
<td><strong>Received<br/>DHT Word Chunks</strong></td> <td><strong>Received DHT<br/>Word Chunks</strong></td>
<td><strong>Received<br/>URLs</strong></td> <td><strong>Received<br/>URLs</strong></td>
#(complete)#:: <td><strong>Location</strong><br/></td>
<td><strong>Address</strong></td> #(c)#::<td><strong>user agent<br/></strong></td>#(/c)#
<td><strong>Hash</strong></td> <td>send&nbsp;<strong>M</strong>essage/<br/>show&nbsp;<strong>P</strong>rofile/<br/>edit&nbsp;<strong>W</strong>iki/<br/>browse&nbsp;<strong>B</strong>log</td>
<td><strong>Age</strong></td>
<td><strong>#Seeds</strong></td>
<td><strong>con/h<br/></strong></td>
<td><strong>user agent<br/></strong></td>
<td><strong>Peer<br/>Ping</strong></td>
#(/complete)#
</tr> </tr>
#{list}# #{list}#
<tr class="TableCell#(dark)#Light::Dark::Summary#(/dark)#"> <tr class="TableCell#(dark)#Light::Dark::Summary#(/dark)#">
<td><nobr> <td >#[hash]#</td>
<a href="MessageSend_p.html?hash=#[hash]#" title="Send message to peer #[fullname]#">m</a>&nbsp; <td #(special)#::class="TableCellActive"#(/special)#>#[shortname]##(ssl)#::<img src="env/grafics/lock.gif" width="11" height="15" title="https supported" alt="https supported" />#(/ssl)#</td>
<a href="ViewProfile.html?hash=#[hash]#&amp;display=1" title="View profile of peer #[fullname]#">p</a>&nbsp;
<a href="goto_p.html?hash=#[hash]#&path=/Wiki.html" title="Read and edit wiki on peer #[fullname]#">w</a>&nbsp;
<a href="goto_p.html?hash=#[hash]#&path=/Blog.html" title="Browse blog of peer #[fullname]#">b</a>&nbsp;
#(updatedProfile)#::<a href="ViewProfile.html?hash=#[hash]#&amp;display=1"><img src="env/grafics/profile.gif" width="54" height="11" alt="Profile updated" /></a>#(/updatedProfile)#
#(updatedWiki)#::<a href="http://#[address]#/Wiki.html?page=#[page]#" title="#[page]#"><img src="env/grafics/wiki.gif" width="54" height="11" alt="Wiki updated" /></a>#(/updatedWiki)#
#(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)#
</nobr></td>
<td #(special)#::class="TableCellActive"#(/special)#><a href="goto_p.html?hash=#[hash]#">#[shortname]#</a>#(ssl)#::<img src="env/grafics/lock.gif" width="11" height="15" title="https supported" alt="https supported" />#(/ssl)#</td>
<td nowrap> <td nowrap>
#(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> #(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]#" class="forceNoExternalIcon">#(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)##{ips}#<a href="#(c)#http://#(ipv6)#::[#(/ipv6)##[ip]##(ipv6)#::]#(/ipv6)#:#[port]#/Network.html?page=1::Network.html?page=4&amp;peerHash=#[hash]#&amp;peerIP=#[ip]#&amp;peerPort=#[port]#&amp;addPeer=add+Peer#(/c)#" class="forceNoExternalIcon"><img src="env/grafics/#(nodestate)#NodeDisqualified::NodeQualified#(/nodestate)##(c)##(ipv6)#IPv4::IPv6#(/ipv6)#::#(ipv6)#IPv4::IPv6#(/ipv6)##(/c)#.gif" width="11" height="11" title="#(c)##(ipv6)#IPv4::IPv6#(/ipv6)#::#(ipv6)#IPv4::IPv6#(/ipv6)##(/c)# #(nodestate)#Peer::Node Peer#(/nodestate)#" /></a>#{/ips}#</td>
<td align="right">#[version]#</td> <td align="right">#[version]#</td>
<td align="right">#[age]#</td>
<td align="right">#[seeds]#</td>
<td align="right">#[connects]#</td>
<td align="right">#[ppm]#</td> <td align="right">#[ppm]#</td>
<td align="right">#[qph]#</td> <td align="right">#[qph]#</td>
<td align="right">#[lastSeen]#</td> <td align="right">#[lastSeen]#</td>
<td align="right">#[utc]#</td> <td align="right">#[utc]#</td>
<td align="right">#[location]#</td>
<td align="right" nowrap>#[uptime]#</td> <td align="right" nowrap>#[uptime]#</td>
<td align="right">#[LCount]#</td> <td align="right">#[LCount]#</td>
<td align="right">#[ICount]#</td> <td align="right">#[ICount]#</td>
@ -160,16 +149,18 @@ document.getElementById("apilink").setAttribute("href", "Network.xml?" + window.
<td align="right">#[sU]#</td> <td align="right">#[sU]#</td>
<td align="right">#[rI]#</td> <td align="right">#[rI]#</td>
<td align="right">#[rU]#</td> <td align="right">#[rU]#</td>
#(complete)# <td align="right">#[location]#</td>
:: #(c)#::<td align="right">#[userAgent]#</td>#(/c)#
<td><a href="http://#[ip]#:#[port]#/Network.html?page=1&amp;ip=">http://#[ip]#:#[port]#</a> #[ips]#</td> <td><nobr>
<td >#[hash]#</td> <a href="MessageSend_p.html?hash=#[hash]#" title="Send message to peer #[fullname]#">m</a>&nbsp;
<td >#[age]#</td> <a href="ViewProfile.html?hash=#[hash]#&amp;display=1" title="View profile of peer #[fullname]#">p</a>&nbsp;
<td align="right">#[seeds]#</td> <a href="goto_p.html?hash=#[hash]#&path=/Wiki.html" title="Read and edit wiki on peer #[fullname]#">w</a>&nbsp;
<td align="right">#[connects]#</td> <a href="goto_p.html?hash=#[hash]#&path=/Blog.html" title="Browse blog of peer #[fullname]#">b</a>&nbsp;
<td align="right">#[userAgent]#</td> #(updatedProfile)#::<a href="ViewProfile.html?hash=#[hash]#&amp;display=1"><img src="env/grafics/profile.gif" width="54" height="11" alt="Profile updated" /></a>#(/updatedProfile)#
<td align="right">[<a href="Network.html?page=4&amp;peerHash=#[hash]#&amp;peerIP=#[ip]#&amp;peerPort=#[port]#&amp;addPeer=add+Peer">Ping</a>]</td> #(updatedWiki)#::<a href="http://#[address]#/Wiki.html?page=#[page]#" title="#[page]#"><img src="env/grafics/wiki.gif" width="54" height="11" alt="Wiki updated" /></a>#(/updatedWiki)#
#(/complete)# #(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)#
</nobr></td>
</tr> </tr>
#{/list}# #{/list}#
</table> </table>

@ -32,6 +32,7 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -210,19 +211,21 @@ public class Network {
Seed peer = new Seed(post.get("peerHash"), map); Seed peer = new Seed(post.get("peerHash"), map);
sb.updateMySeed(); sb.updateMySeed();
final int added = Protocol.hello(sb.peers.mySeed(), sb.peers.peerActions, peer); final Map<String, String> response = Protocol.hello(sb.peers.mySeed(), sb.peers.peerActions, peer);
if (added <= 0) { if (response == null) {
prop.put("table_comment",1); 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 { } else {
String yourtype = response.get("yourtype");
String yourip = response.get("yourip");
peer = sb.peers.getConnected(peer.hash); peer = sb.peers.getConnected(peer.hash);
if (peer == null) { if (peer == null) {
prop.put("table_comment",1); 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 { } else {
prop.put("table_comment",2); 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()); prop.putHTML("table_comment_details",peer.toString());
} }
} }
@ -285,7 +288,7 @@ public class Network {
boolean dark = true; boolean dark = true;
Seed seed; 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 onlyIncomingDHT = (post != null && post.containsKey("onlydhtin"));
final boolean onlyNode = (post != null && post.containsKey("onlynode")); final boolean onlyNode = (post != null && post.containsKey("onlynode"));
final long onlyAgeOverDays = post == null ? 0 : post.getLong("onlyageoverdays", 0); 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 + "_updatedWikiPage", 0);
prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 0); prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 0);
prop.put(STR_TABLE_LIST + conCount + "_isCrawling", 0); prop.put(STR_TABLE_LIST + conCount + "_isCrawling", 0);
String ip = seed.getIP();
if (conCount >= maxCount) { break; } if (conCount >= maxCount) { break; }
if (sb.peers != null && sb.peers.mySeed() != null && seed.hash != null && seed.hash.equals(sb.peers.mySeed().hash)) { 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); prop.put(STR_TABLE_LIST + conCount + "_dark", 2);
@ -356,7 +360,7 @@ public class Network {
} else { } else {
prop.put(STR_TABLE_LIST + conCount + "_updatedWiki", 1); prop.put(STR_TABLE_LIST + conCount + "_updatedWiki", 1);
prop.putHTML(STR_TABLE_LIST + conCount + "_updatedWiki_page", wikiMap.get("page")); 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) { if ((blogMap = updatedBlog.get(seed.hash)) == null) {
prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 0); prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 0);
@ -364,7 +368,7 @@ public class Network {
prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 1); 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_page", blogMap.get("page"));
prop.putHTML(STR_TABLE_LIST + conCount + "_updatedBlog_subject", blogMap.get("subject")); 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(); PPM = seed.getPPM();
QPM = seed.getQPM(); QPM = seed.getQPM();
@ -386,30 +390,39 @@ public class Network {
userAgent = ClientIdentification.yacyInternetCrawlerAgent.userAgent; userAgent = ClientIdentification.yacyInternetCrawlerAgent.userAgent;
location = ClientIdentification.generateLocation(); location = ClientIdentification.generateLocation();
} else { } else {
userAgent = sb.peers.peerActions.getUserAgent(seed.getIP()); userAgent = sb.peers.peerActions.getUserAgent(ip);
location = ClientIdentification.parseLocationInUserAgent(userAgent); location = ClientIdentification.parseLocationInUserAgent(userAgent);
} }
if (location.length() > 10) location = location.substring(0, 10); if (location.length() > 10) location = location.substring(0, 10);
if (location.length() == 0) { if (location.length() == 0) {
Locale l = Domains.getLocale(seed.getIP()); Locale l = Domains.getLocale(ip);
if (l != null) location = l.toString(); if (l != null) location = l.toString();
} }
prop.putHTML(STR_TABLE_LIST + conCount + "_location", location); prop.putHTML(STR_TABLE_LIST + conCount + "_location", location);
if (complete) { String port = seed.get(Seed.PORT, "-");
prop.put(STR_TABLE_LIST + conCount + "_complete", 1); Set<String> ips = seed.getIPs();
prop.putHTML(STR_TABLE_LIST + conCount + "_complete_ip", seed.getIP() ); int ipsc = 0;
prop.putHTML(STR_TABLE_LIST + conCount + "_complete_ips", seed.getIPs().toString() ); for (String s: ips) {
prop.put(STR_TABLE_LIST + conCount + "_complete_port", seed.get(Seed.PORT, "-") ); prop.put(STR_TABLE_LIST + conCount + "_ips_" + ipsc + "_nodestate", seed.getFlagRootNode() ? 1 : 0);
prop.put(STR_TABLE_LIST + conCount + "_complete_hash", seed.hash); prop.put(STR_TABLE_LIST + conCount + "_ips_" + ipsc + "_c", c ? 1 : 0);
prop.put(STR_TABLE_LIST + conCount + "_complete_age", seed.getAge()); prop.putHTML(STR_TABLE_LIST + conCount + "_ips_" + ipsc + "_c_hash", seed.hash);
prop.putNum(STR_TABLE_LIST + conCount + "_complete_seeds", seed.getLong(Seed.SCOUNT, 0L)); prop.putHTML(STR_TABLE_LIST + conCount + "_ips_" + ipsc + "_c_ip", s);
prop.putNum(STR_TABLE_LIST + conCount + "_complete_connects", seed.getFloat(Seed.CCOUNT, 0F)); prop.putHTML(STR_TABLE_LIST + conCount + "_ips_" + ipsc + "_c_port", port);
prop.putHTML(STR_TABLE_LIST + conCount + "_complete_userAgent", userAgent); 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 { } else {
prop.put(STR_TABLE_LIST + conCount + "_complete", 0); prop.put(STR_TABLE_LIST + conCount + "_c", 0);
} }
if (seed.isJunior()) { if (seed.isJunior()) {
prop.put(STR_TABLE_LIST + conCount + "_type", 0); prop.put(STR_TABLE_LIST + conCount + "_type", 0);
} else if(seed.isSenior()){ } 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 + "_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()) { if (seed.getFlagAcceptRemoteIndex()) {
prop.put(STR_TABLE_LIST + conCount + "_dhtreceive_peertags", ""); prop.put(STR_TABLE_LIST + conCount + "_dhtreceive_peertags", "");
} else { } else {
@ -479,7 +489,7 @@ public class Network {
prop.put("table", 1); prop.put("table", 1);
prop.putNum("table_num", conCount); prop.putNum("table_num", conCount);
prop.putNum("table_total", ((page == 1) && (iAmActive)) ? (size + 1) : size ); 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); prop.put("page", page);

@ -21,17 +21,16 @@
<direct>#(type_direct)#direct::passive#(/type_direct)#</direct> <direct>#(type_direct)#direct::passive#(/type_direct)#</direct>
<acceptcrawl>#[acceptcrawl]#</acceptcrawl> <acceptcrawl>#[acceptcrawl]#</acceptcrawl>
<dhtreceive>#[dhtreceive]#</dhtreceive> <dhtreceive>#[dhtreceive]#</dhtreceive>
<nodestate>#[nodestate]#</nodestate> <nodestate>#(nodestate)#false::true#(/nodestate)#</nodestate>
<location>#[location]#</location> <location>#[location]#</location>
<seedurl>#[type_url]#</seedurl> <seedurl>#[type_url]#</seedurl>
#(complete)#
::
<age>#[age]#</age> <age>#[age]#</age>
<seeds>#[seeds]#</seeds> <seeds>#[seeds]#</seeds>
<connects>#[connects]#</connects> <connects>#[connects]#</connects>
<address>#[ip]#:#[port]#</address> #{ips}#<ip>#(c)##[ip]#::#[ip]##(/c)#</ip>#{/ips}#
<useragent>#[userAgent]#</useragent> #{ips}#<address>#(c)##(ipv6)#::[#(/ipv6)##[ip]##(ipv6)#::]#(/ipv6)#:#[port]#::#(/c)#</address>#{/ips}#
#(/complete)# <port>#[port]#</port>
#(c)#::<useragent>#[userAgent]#</useragent>#(/c)#
</peer> </peer>
#{/list}# #{/list}#
:: ::

Before

Width:  |  Height:  |  Size: 875 B

After

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 B

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 B

@ -185,14 +185,7 @@ public class Network
+ this.sb.peers.sizeConnected() + this.sb.peers.sizeConnected()
+ " new peer(s)"); + " new peer(s)");
} }
final int newSeeds = publishMySeed(false); publishMySeed(false);
if ( newSeeds > 0 ) {
log.info("received "
+ newSeeds
+ " new peer(s), know a total of "
+ this.sb.peers.sizeConnected()
+ " different peers");
}
} }
// use our own formatter to prevent concurrency locks with other processes // use our own formatter to prevent concurrency locks with other processes
@ -202,7 +195,7 @@ public class Network
protected class publishThread extends Thread protected class publishThread extends Thread
{ {
int added; private Map<String, String> result;
private final Seed seed; private final Seed seed;
private final Semaphore sync; private final Semaphore sync;
private final List<Thread> syncList; private final List<Thread> syncList;
@ -219,14 +212,14 @@ public class Network
this.syncList = syncList; this.syncList = syncList;
this.seed = seed; this.seed = seed;
this.added = 0; this.result = null;
} }
@Override @Override
public final void run() { public final void run() {
try { try {
this.added = Protocol.hello(Network.this.sb.peers.mySeed(), Network.this.sb.peers.peerActions, this.seed); this.result = Protocol.hello(Network.this.sb.peers.mySeed(), Network.this.sb.peers.peerActions, this.seed);
if ( this.added < 0 ) { if ( this.result == null ) {
// no or wrong response, delete that address // no or wrong response, delete that address
final String cause = "peer ping to peer resulted in error response (added < 0)"; final String cause = "peer ping to peer resulted in error response (added < 0)";
log.info("publish: disconnected " log.info("publish: disconnected "
@ -324,7 +317,7 @@ public class Network
} }
} }
private int publishMySeed(final boolean force) { private boolean publishMySeed(final boolean force) {
try { try {
// call this after the httpd was started up // call this after the httpd was started up
@ -349,9 +342,7 @@ public class Network
// getting a list of peers to contact // getting a list of peers to contact
if ( this.sb.peers.mySeed().get(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN).equals(Seed.PEERTYPE_VIRGIN) ) { if ( this.sb.peers.mySeed().get(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN).equals(Seed.PEERTYPE_VIRGIN) ) {
if ( attempts > PING_INITIAL ) { if (attempts > PING_INITIAL) attempts = PING_INITIAL;
attempts = PING_INITIAL;
}
final Set<byte[]> ch = Switchboard.getSwitchboard().clusterhashes; final Set<byte[]> ch = Switchboard.getSwitchboard().clusterhashes;
seeds = DHTSelection.seedsByAge(this.sb.peers, true, attempts - ((ch == null) ? 0 : ch.size())); // best for fast connection 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 // add also all peers from cluster if this is a public robinson cluster
@ -363,9 +354,7 @@ public class Network
seed = seeds.get(hash); seed = seeds.get(hash);
if (seed == null) { if (seed == null) {
seed = this.sb.peers.get(hash); seed = this.sb.peers.get(hash);
if ( seed == null ) { if (seed == null) continue;
continue;
}
} }
seeds.put(hash, seed); 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 seeds = DHTSelection.seedsByAge(this.sb.peers, false, attempts); // best for seed list maintenance/cleaning
} }
if ( seeds == null || seeds.isEmpty() ) { if (seeds == null || seeds.isEmpty()) return false;
return 0; if (seeds.size() < attempts) attempts = seeds.size();
}
if ( seeds.size() < attempts ) {
attempts = seeds.size();
}
// This will try to get Peers that are not currently in amIAccessibleDB // This will try to get Peers that are not currently in amIAccessibleDB
final Iterator<Seed> si = seeds.values().iterator(); final Iterator<Seed> si = seeds.values().iterator();
@ -408,14 +393,13 @@ public class Network
log.severe("publishMySeed: problem with news encoding", e); log.severe("publishMySeed: problem with news encoding", e);
} }
this.sb.peers.mySeed().setUnusedFlags(); this.sb.peers.mySeed().setUnusedFlags();
int newSeeds = -1;
//if (seeds.length > 1) { //if (seeds.length > 1) {
// holding a reference to all started threads // holding a reference to all started threads
int contactedSeedCount = 0; int contactedSeedCount = 0;
final List<Thread> syncList = Collections.synchronizedList(new LinkedList<Thread>()); // memory for threads final List<Thread> syncList = Collections.synchronizedList(new LinkedList<Thread>()); // memory for threads
final Semaphore sync = new Semaphore(attempts); 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; int i = 0;
while ( si.hasNext() ) { while ( si.hasNext() ) {
seed = si.next(); seed = si.next();
@ -426,9 +410,7 @@ public class Network
i++; i++;
final String address = seed.getPublicAddress(seed.getIP()); final String address = seed.getPublicAddress(seed.getIP());
if ( log.isFine() ) { if ( log.isFine() ) log.fine("HELLO #" + i + " to peer '" + seed.get(Seed.NAME, "") + "' at " + address); // debug
log.fine("HELLO #" + i + " to peer '" + seed.get(Seed.NAME, "") + "' at " + address); // debug
}
final String seederror = seed.isProper(false); final String seederror = seed.isProper(false);
if ( (address == null) || (seederror != null) ) { if ( (address == null) || (seederror != null) ) {
// we don't like that address, delete it // we don't like that address, delete it
@ -456,15 +438,6 @@ public class Network
// getting a reference to the finished thread // getting a reference to the finished thread
final publishThread t = (publishThread) syncList.remove(0); 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; int accessible = 0;
@ -486,19 +459,9 @@ public class Network
} }
} }
} }
if ( log.isFine() ) { if (log.isFine()) log.fine("DBSize before -> after Cleanup: " + dbSize + " -> " + amIAccessibleDB.size());
log
.fine("DBSize before -> after Cleanup: "
+ dbSize
+ " -> "
+ amIAccessibleDB.size());
}
} }
log.info("PeerPing: I am accessible for " log.info("PeerPing: I am accessible for " + accessible + " peer(s), not accessible for " + notaccessible + " peer(s).");
+ accessible
+ " peer(s), not accessible for "
+ notaccessible
+ " peer(s).");
if ( (accessible + notaccessible) > 0 ) { if ( (accessible + notaccessible) > 0 ) {
final String newPeerType; final String newPeerType;
@ -517,11 +480,7 @@ public class Network
if ( this.sb.peers.mySeed().orVirgin().equals(newPeerType) ) { if ( this.sb.peers.mySeed().orVirgin().equals(newPeerType) ) {
log.info("PeerPing: myType is " + this.sb.peers.mySeed().orVirgin()); log.info("PeerPing: myType is " + this.sb.peers.mySeed().orVirgin());
} else { } else {
log.info("PeerPing: changing myType from '" log.info("PeerPing: changing myType from '" + this.sb.peers.mySeed().orVirgin() + "' to '" + newPeerType + "'");
+ this.sb.peers.mySeed().orVirgin()
+ "' to '"
+ newPeerType
+ "'");
this.sb.peers.mySeed().put(Seed.PEERTYPE, newPeerType); this.sb.peers.mySeed().put(Seed.PEERTYPE, newPeerType);
} }
} else { } else {
@ -534,20 +493,11 @@ public class Network
this.sb.peers.saveMySeed(); this.sb.peers.saveMySeed();
// if we have an address, we do nothing // if we have an address, we do nothing
if ( this.sb.peers.mySeed().isProper(true) == null && !force ) { if (this.sb.peers.mySeed().isProper(true) == null) return true;
return 0;
}
if ( newSeeds > 0 ) {
return newSeeds;
}
// still no success: ask own NAT or internet responder // still no success
//final boolean DI604use = switchboard.getConfig("DI604use", "false").equals("true");
//final String DI604pw = switchboard.getConfig("DI604pw", "");
final String ip = this.sb.getConfig("staticIP", ""); 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)) { if (Seed.isProperIP(ip)) {
this.sb.peers.mySeed().setIP(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()); log.info("publish: no recipient found, our address is " + this.sb.peers.mySeed().getIPs());
this.sb.peers.saveMySeed(); this.sb.peers.saveMySeed();
return 0; return false;
} catch (final InterruptedException e ) { } catch (final InterruptedException e ) {
try { try {
log.info("publish: Interruption detected while publishing my seed."); 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."); log.info("publish: Shutdown off all remaining publishing thread finished.");
} catch (final Exception ee ) { } catch (final Exception ee ) {
log.warn( log.warn("publish: Unexpected error while trying to shutdown all remaining publishing threads.", e);
"publish: Unexpected error while trying to shutdown all remaining publishing threads.",
e);
} }
return 0; return false;
} }
} }

@ -167,7 +167,7 @@ public final class Protocol {
* *
* @return the number of new seeds * @return the number of new seeds
*/ */
public static int hello( public static Map<String, String> hello(
final Seed mySeed, final Seed mySeed,
final PeerActions peerActions, final PeerActions peerActions,
final Seed otherSeed) { final Seed otherSeed) {
@ -201,7 +201,7 @@ public final class Protocol {
Network.log.info("yacyClient.hello thread '" Network.log.info("yacyClient.hello thread '"
+ Thread.currentThread().getName() + Thread.currentThread().getName()
+ "' interrupted."); + "' interrupted.");
return -1; return null;
} }
Network.log.info("yacyClient.hello thread '" + Thread.currentThread().getName() + "', peer " + address + "; exception: " + e.getMessage()); Network.log.info("yacyClient.hello thread '" + Thread.currentThread().getName() + "', peer " + address + "; exception: " + e.getMessage());
// try again (go into loop) // try again (go into loop)
@ -211,7 +211,7 @@ public final class Protocol {
if (result == null || result.size() == 0) { if (result == null || result.size() == 0) {
Network.log.info("yacyClient.hello result error: " Network.log.info("yacyClient.hello result error: "
+ ((result == null) ? "result null" : ("result=" + result.toString()))); + ((result == null) ? "result null" : ("result=" + result.toString())));
return -1; return null;
} }
Network.log.info("yacyClient.hello thread '" Network.log.info("yacyClient.hello thread '"
+ Thread.currentThread().getName() + Thread.currentThread().getName()
@ -233,7 +233,7 @@ public final class Protocol {
try { try {
// patch the remote peer address to avoid that remote peers spoof the network with wrong addresses // patch the remote peer address to avoid that remote peers spoof the network with wrong addresses
final int p = address.lastIndexOf(':'); final int p = address.lastIndexOf(':');
if ( p < 0 ) return -1; if ( p < 0 ) return null;
String h = address.substring(0, p); String h = address.substring(0, p);
if (h.charAt(0) == '[') h = h.substring(1); if (h.charAt(0) == '[') h = h.substring(1);
if (h.charAt(h.length() - 1) == ']') h = h.substring(0, h.length() - 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()); otherPeer = Seed.genRemoteSeed(seed, false, ie.getHostAddress());
if ( !otherPeer.hash.equals(otherSeed.hash) ) { if ( !otherPeer.hash.equals(otherSeed.hash) ) {
Network.log.info("yacyClient.hello: consistency error: otherPeer.hash = " + otherPeer.hash + ", otherHash = " + 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 ) { } catch (final IOException e ) {
Network.log.info("yacyClient.hello: consistency error: other seed bad:" + e.getMessage() + ", seed=" + seed); 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 + mytype
+ ", rejecting other peer."); + ", rejecting other peer.");
} }
return -1; return null;
} }
if ( mySeed.orVirgin().equals(Seed.PEERTYPE_VIRGIN) ) { if ( mySeed.orVirgin().equals(Seed.PEERTYPE_VIRGIN) ) {
mySeed.put(Seed.PEERTYPE, mytype); mySeed.put(Seed.PEERTYPE, mytype);
@ -322,7 +322,7 @@ public final class Protocol {
final String error = mySeed.isProper(true); final String error = mySeed.isProper(true);
if ( error != null ) { if ( error != null ) {
Network.log.warn("yacyClient.hello mySeed error - not proper: " + error); 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 //final Date remoteTime = yacyCore.parseUniversalDate((String) result.get(yacySeed.MYTIME)); // read remote time
@ -347,7 +347,7 @@ public final class Protocol {
if ( i == 1 ) { if ( i == 1 ) {
final int p = address.indexOf(':'); final int p = address.indexOf(':');
if ( p < 0 ) { if ( p < 0 ) {
return -1; return null;
} }
InetAddress ia = Domains.dnsResolve(address.substring(0, p)); InetAddress ia = Domains.dnsResolve(address.substring(0, p));
if (ia == null) continue; if (ia == null) continue;
@ -371,7 +371,7 @@ public final class Protocol {
// update event tracker // update event tracker
EventTracker.update(EventTracker.EClass.PEERPING, new ProfilingGraph.EventPing(mySeed.getName(), otherSeed.getName(), true, connectedAfter - connectedBefore), false); 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) { public static Seed querySeed(final Seed target, final String seedHash) {

Loading…
Cancel
Save