From b6c6a5d6961c994884e9c81385ea4ed31e9670f0 Mon Sep 17 00:00:00 2001 From: str4d Date: Sun, 9 Apr 2017 06:28:00 +0000 Subject: [PATCH] Whitespace --- .../router/web/ProfileOrganizerRenderer.java | 27 +++---- .../src/net/i2p/router/web/SummaryHelper.java | 72 +++++++++---------- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ProfileOrganizerRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/ProfileOrganizerRenderer.java index 01ff4f6150..c5375bb512 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ProfileOrganizerRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ProfileOrganizerRenderer.java @@ -26,7 +26,7 @@ import net.i2p.stat.RateStat; class ProfileOrganizerRenderer { private final RouterContext _context; private final ProfileOrganizer _organizer; - + public ProfileOrganizerRenderer(ProfileOrganizer organizer, RouterContext context) { _context = context; _organizer = organizer; @@ -38,10 +38,10 @@ class ProfileOrganizerRenderer { public void renderStatusHTML(Writer out, int mode) throws IOException { boolean full = mode == 1; Set peers = _organizer.selectAllPeers(); - + long now = _context.clock().now(); long hideBefore = now - 90*60*1000; - + Set order = new TreeSet(mode == 2 ? new HashComparator() : new ProfileComparator()); int older = 0; int standard = 0; @@ -66,7 +66,7 @@ class ProfileOrganizerRenderer { } order.add(prof); } - + int fast = 0; int reliable = 0; int integrated = 0; @@ -99,7 +99,7 @@ class ProfileOrganizerRenderer { int prevTier = 1; for (PeerProfile prof : order) { Hash peer = prof.getPeer(); - + int tier = 0; boolean isIntegrated = false; if (_organizer.isFast(peer)) { @@ -113,23 +113,23 @@ class ProfileOrganizerRenderer { } else { tier = 3; } - + if (_organizer.isWellIntegrated(peer)) { isIntegrated = true; integrated++; } - + if (tier != prevTier) buf.append("
\n"); prevTier = tier; - + buf.append(""); buf.append(_context.commSystem().renderPeerHTML(peer)); // debug //if(prof.getIsExpandedDB()) // buf.append(" ** "); buf.append(""); - + switch (tier) { case 1: buf.append(_t("Fast, High Capacity")); break; case 2: buf.append(_t("High Capacity")); break; @@ -179,6 +179,7 @@ class ProfileOrganizerRenderer { if (total / fails <= 10) // hide if < 10% buf.append(' ').append(fails).append('/').append(total).append(' ').append(_t("Test Fails")); } + buf.append(" "); //buf.append("").append(_t("profile")).append(""); @@ -343,7 +344,7 @@ class ProfileOrganizerRenderer { out.write(buf.toString()); out.flush(); } - + private class ProfileComparator extends HashComparator { public int compare(PeerProfile left, PeerProfile right) { if (_context.profileOrganizer().isFast(left.getPeer())) { @@ -380,7 +381,7 @@ class ProfileOrganizerRenderer { } } } - + /** * Used for floodfill-only page * As of 0.9.29, sorts in true binary order, not base64 string @@ -390,9 +391,9 @@ class ProfileOrganizerRenderer { public int compare(PeerProfile left, PeerProfile right) { return DataHelper.compareTo(left.getPeer().getData(), right.getPeer().getData()); } - + } - + 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 = HelperBase._x("n/a"); diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java index dc7c19391c..6733f8289c 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java @@ -77,7 +77,7 @@ public class SummaryHelper extends HelperBase { */ public String getIdent() { if (_context == null) return "[no router]"; - + if (_context.routerHash() != null) return _context.routerHash().toBase64().substring(0, 4); else @@ -96,14 +96,14 @@ public class SummaryHelper extends HelperBase { */ public String getUptime() { if (_context == null) return "[no router]"; - + Router router = _context.router(); if (router == null) return "[not up]"; else return DataHelper.formatDuration2(router.getUptime()); } - + /** this displayed offset, not skew - now handled in reachability() @@ -118,17 +118,17 @@ public class SummaryHelper extends HelperBase { return " (" + DataHelper.formatDuration2(diff) + " " + _t("skew") + ")"; } **/ - + /** allowReseed */ public boolean allowReseed() { return _context.netDb().isInitialized() && (_context.netDb().getKnownRouters() < 30) || _context.getBooleanProperty("i2p.alwaysAllowReseed"); } - + /** subtract one for ourselves, so if we know no other peers it displays zero */ public int getAllPeers() { return Math.max(_context.netDb().getKnownRouters() - 1, 0); } - + public String getReachability() { return reachability(); // + timeSkew(); // testing @@ -215,7 +215,7 @@ public class SummaryHelper extends HelperBase { return _t(status.toStatusString()); } } - + /** * Retrieve amount of used memory. * @@ -228,7 +228,7 @@ public class SummaryHelper extends HelperBase { return integerFormatter.format(used) + "KB (" + usedPc + "%)"; } ********/ - + /** * How many peers we are talking to now * @@ -326,14 +326,14 @@ public class SummaryHelper extends HelperBase { return formatPair(_context.bandwidthLimiter().getReceiveBps(), _context.bandwidthLimiter().getSendBps()); } - + /** * @return "x.xx / y.yy {K|M}" */ public String getFiveMinuteKBps() { if (_context == null) return "0 / 0"; - + RateStat receiveRate = _context.statManager().getRate("bw.recvRate"); double in = 0; if (receiveRate != null) { @@ -350,14 +350,14 @@ public class SummaryHelper extends HelperBase { } return formatPair(in, out); } - + /** * @return "x.xx / y.yy {K|M}" */ public String getLifetimeKBps() { if (_context == null) return "0 / 0"; - + RateStat receiveRate = _context.statManager().getRate("bw.recvRate"); double in; if (receiveRate == null) @@ -372,7 +372,7 @@ public class SummaryHelper extends HelperBase { out = sendRate.getLifetimeAverageValue(); return formatPair(in, out); } - + /** * @return "x.xx / y.yy {K|M}" */ @@ -406,12 +406,12 @@ public class SummaryHelper extends HelperBase { public String getInboundTransferred() { if (_context == null) return "0"; - + long received = _context.bandwidthLimiter().getTotalAllocatedInboundBytes(); return DataHelper.formatSize2(received) + 'B'; } - + /** * How much data have we sent since the router started (pretty printed * string with 2 decimal places and the appropriate units - GB/MB/KB/bytes) @@ -420,11 +420,11 @@ public class SummaryHelper extends HelperBase { public String getOutboundTransferred() { if (_context == null) return "0"; - + long sent = _context.bandwidthLimiter().getTotalAllocatedOutboundBytes(); return DataHelper.formatSize2(sent) + 'B'; } - + /** * Client destinations connected locally. * @@ -433,7 +433,7 @@ public class SummaryHelper extends HelperBase { public String getDestinations() { // convert the set to a list so we can sort by name and not lose duplicates List clients = new ArrayList(_context.clientManager().listClients()); - + StringBuilder buf = new StringBuilder(512); buf.append("

"); - + for (Destination client : clients) { String name = getName(client); Hash h = client.calculateHash(); - + buf.append("\"Server\""); @@ -463,9 +463,9 @@ public class SummaryHelper extends HelperBase { if (ls != null && _context.tunnelManager().getOutboundClientTunnelCount(h) > 0) { long timeToExpire = ls.getEarliestLeaseDate() - _context.clock().now(); if (timeToExpire < 0) { - // red or yellow light + // red or yellow light buf.append("\"").append(_t("Rebuilding")).append("…\"\n"); + buf.append(" ").append(_t("ago")).append(". ").append(_t("Rebuilding")).append("…\">\n"); } else { // green light buf.append("\"Ready\"\n"); @@ -481,7 +481,7 @@ public class SummaryHelper extends HelperBase { } return buf.toString(); } - + /** * Compare translated nicknames - put "shared clients" first in the sort * Inner class, can't be Serializable @@ -529,7 +529,7 @@ public class SummaryHelper extends HelperBase { else return _context.tunnelManager().getFreeTunnelCount(); } - + /** * How many active outbound tunnels we have. * @@ -540,7 +540,7 @@ public class SummaryHelper extends HelperBase { else return _context.tunnelManager().getOutboundTunnelCount(); } - + /** * How many inbound client tunnels we have. * @@ -551,7 +551,7 @@ public class SummaryHelper extends HelperBase { else return _context.tunnelManager().getInboundClientTunnelCount(); } - + /** * How many active outbound client tunnels we have. * @@ -562,7 +562,7 @@ public class SummaryHelper extends HelperBase { else return _context.tunnelManager().getOutboundClientTunnelCount(); } - + /** * How many tunnels we are participating in. * @@ -591,7 +591,7 @@ public class SummaryHelper extends HelperBase { public String getJobLag() { if (_context == null) return "0"; - + RateStat rs = _context.statManager().getRate("jobQueue.jobLag"); if (rs == null) return "0"; @@ -603,14 +603,14 @@ public class SummaryHelper extends HelperBase { * How long it takes us to pump out a message, averaged over the last minute * (pretty printed with the units attached) * - */ + */ public String getMessageDelay() { if (_context == null) return "0"; - + return DataHelper.formatDuration2(_context.throttle().getMessageDelay()); } - + /** * How long it takes us to test our tunnels, averaged over the last 10 minutes * (pretty printed with the units attached) @@ -619,23 +619,23 @@ public class SummaryHelper extends HelperBase { public String getTunnelLag() { if (_context == null) return "0"; - + return DataHelper.formatDuration2(_context.throttle().getTunnelLag()); } - + public String getTunnelStatus() { if (_context == null) return ""; return _context.throttle().getTunnelStatus(); } - + public String getInboundBacklog() { if (_context == null) return "0"; - + return String.valueOf(_context.tunnelManager().getInboundBuildQueueSize()); } - + /******* public String getPRNGStatus() { Rate r = _context.statManager().getRate("prng.bufferWaitTime").getRate(60*1000);