tags
This commit is contained in:
@ -84,8 +84,8 @@ public class NetDbRenderer {
|
||||
public void renderLeaseSetHTML(Writer out) throws IOException {
|
||||
StringBuilder buf = new StringBuilder(4*1024);
|
||||
buf.append("<h2>" + _("Network Database Contents") + "</h2>\n");
|
||||
buf.append("<a href=\"netdb.jsp\">" + _("View") + " RouterInfo</a>");
|
||||
buf.append("<h3>LeaseSets</h3>\n");
|
||||
buf.append("<a href=\"netdb.jsp\">" + _("View RouterInfo") + "</a>");
|
||||
buf.append("<h3>").append(_("LeaseSets")).append("</h3>\n");
|
||||
Set leases = new TreeSet(new LeaseSetComparator());
|
||||
leases.addAll(_context.netDb().getLeases());
|
||||
long now = _context.clock().now();
|
||||
@ -132,7 +132,7 @@ public class NetDbRenderer {
|
||||
}
|
||||
|
||||
public void renderStatusHTML(Writer out, boolean full) throws IOException {
|
||||
out.write("<h2>" + _("Network Database Contents") + " (<a href=\"netdb.jsp?l=1\">" + _("View") + " LeaseSets</a>)</h2>\n");
|
||||
out.write("<h2>" + _("Network Database Contents") + " (<a href=\"netdb.jsp?l=1\">" + _("View LeaseSets") + "</a>)</h2>\n");
|
||||
if (!_context.netDb().isInitialized()) {
|
||||
out.write(_("Not initialized"));
|
||||
out.flush();
|
||||
|
@ -148,15 +148,15 @@ class ProfileOrganizerRenderer {
|
||||
buf.append("</td><td align=\"right\">").append(num(prof.getIntegrationValue()));
|
||||
buf.append("</td><td align=\"center\">");
|
||||
if (_context.shitlist().isShitlisted(peer)) buf.append(_("Banned"));
|
||||
if (prof.getIsFailing()) buf.append(" ").append(_("Failing"));
|
||||
if (_context.commSystem().wasUnreachable(peer)) buf.append(" ").append(_("Unreachable"));
|
||||
if (prof.getIsFailing()) buf.append(' ').append(_("Failing"));
|
||||
if (_context.commSystem().wasUnreachable(peer)) buf.append(' ').append(_("Unreachable"));
|
||||
Rate failed = prof.getTunnelHistory().getFailedRate().getRate(30*60*1000);
|
||||
long fails = failed.getCurrentEventCount() + failed.getLastEventCount();
|
||||
if (fails > 0) {
|
||||
Rate accepted = prof.getTunnelCreateResponseTime().getRate(30*60*1000);
|
||||
long total = fails + accepted.getCurrentEventCount() + accepted.getLastEventCount();
|
||||
if (total / fails <= 10) // hide if < 10%
|
||||
buf.append(' ').append(fails).append('/').append(total).append(" ").append(_("Test Fails"));
|
||||
buf.append(' ').append(fails).append('/').append(total).append(' ').append(_("Test Fails"));
|
||||
}
|
||||
buf.append(" </td>");
|
||||
buf.append("<td nowrap align=\"center\"><a target=\"_blank\" href=\"dumpprofile.jsp?peer=")
|
||||
@ -228,15 +228,19 @@ class ProfileOrganizerRenderer {
|
||||
buf.append("<td align=\"right\">").append(davg(dbh, 60*60*1000l)).append("</td>");
|
||||
buf.append("<td align=\"right\">").append(davg(dbh, 24*60*60*1000l)).append("</td>");
|
||||
} else {
|
||||
buf.append("<td align=\"right\">n/a<td align=\"right\">n/a<td align=\"right\">n/a<td align=\"right\">n/a<td align=\"right\">n/a<td align=\"right\">n/a");
|
||||
for (int i = 0; i < 6; i++)
|
||||
buf.append("<td align=\"right\">").append(_(NA));
|
||||
}
|
||||
}
|
||||
buf.append("</table>");
|
||||
|
||||
buf.append("<h3>").append(_("Thresholds:")).append("</h3>");
|
||||
buf.append("<p><b>").append(_("Speed")).append(":</b> ").append(num(_organizer.getSpeedThreshold())).append(" (").append(fast).append(" fast peers)<br>");
|
||||
buf.append("<b>").append(_("Capacity")).append(":</b> ").append(num(_organizer.getCapacityThreshold())).append(" (").append(reliable).append(" high capacity peers)<br>");
|
||||
buf.append("<b>").append(_("Integration")).append(":</b> ").append(num(_organizer.getIntegrationThreshold())).append(" (").append(integrated).append(" well integrated peers)</p>");
|
||||
buf.append("<p><b>").append(_("Speed")).append(":</b> ").append(num(_organizer.getSpeedThreshold()))
|
||||
.append(" (").append(fast).append(' ').append(_("fast peers")).append(")<br>");
|
||||
buf.append("<b>").append(_("Capacity")).append(":</b> ").append(num(_organizer.getCapacityThreshold()))
|
||||
.append(" (").append(reliable).append(' ').append(_("high capacity peers")).append(")<br>");
|
||||
buf.append("<b>").append(_("Integration")).append(":</b> ").append(num(_organizer.getIntegrationThreshold()))
|
||||
.append(" (").append(integrated).append(' ').append(_(" well integrated peers")).append(")</p>");
|
||||
buf.append("<h3>").append(_("Definitions")).append(":</h3><ul>");
|
||||
buf.append("<li><b>").append(_("groups")).append("</b>: ").append(_("as determined by the profile organizer")).append("</li>");
|
||||
buf.append("<li><b>").append(_("caps")).append("</b>: ").append(_("capabilities in the netDb, not used to determine profiles")).append("</li>");
|
||||
@ -301,29 +305,29 @@ class ProfileOrganizerRenderer {
|
||||
|
||||
private final static DecimalFormat _fmt = new DecimalFormat("###,##0.00");
|
||||
private final static String num(double num) { synchronized (_fmt) { return _fmt.format(num); } }
|
||||
private final static String na = "n/a";
|
||||
private final static String NA = HelperBase._x("n/a");
|
||||
|
||||
private static String avg (PeerProfile prof, long rate) {
|
||||
private String avg (PeerProfile prof, long rate) {
|
||||
RateStat rs = prof.getDbResponseTime();
|
||||
if (rs == null)
|
||||
return na;
|
||||
return _(NA);
|
||||
Rate r = rs.getRate(rate);
|
||||
if (r == null)
|
||||
return na;
|
||||
return _(NA);
|
||||
long c = r.getCurrentEventCount() + r.getLastEventCount();
|
||||
if (c == 0)
|
||||
return na;
|
||||
return _(NA);
|
||||
double d = r.getCurrentTotalValue() + r.getLastTotalValue();
|
||||
return Math.round(d/c) + "ms";
|
||||
}
|
||||
|
||||
private static String davg (DBHistory dbh, long rate) {
|
||||
private String davg (DBHistory dbh, long rate) {
|
||||
RateStat rs = dbh.getFailedLookupRate();
|
||||
if (rs == null)
|
||||
return na;
|
||||
return _(NA);
|
||||
Rate r = rs.getRate(rate);
|
||||
if (r == null)
|
||||
return na;
|
||||
return _(NA);
|
||||
long c = r.getCurrentEventCount() + r.getLastEventCount();
|
||||
return "" + c;
|
||||
}
|
||||
|
Reference in New Issue
Block a user