Changeset b6c6a5d
- Timestamp:
- Apr 9, 2017 6:28:00 AM (4 years ago)
- Branches:
- master
- Children:
- a0911a4
- Parents:
- 5353fd9
- Location:
- apps/routerconsole/java/src/net/i2p/router/web
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
apps/routerconsole/java/src/net/i2p/router/web/ProfileOrganizerRenderer.java
r5353fd9 rb6c6a5d 27 27 private final RouterContext _context; 28 28 private final ProfileOrganizer _organizer; 29 29 30 30 public ProfileOrganizerRenderer(ProfileOrganizer organizer, RouterContext context) { 31 31 _context = context; … … 39 39 boolean full = mode == 1; 40 40 Set<Hash> peers = _organizer.selectAllPeers(); 41 41 42 42 long now = _context.clock().now(); 43 43 long hideBefore = now - 90*60*1000; 44 44 45 45 Set<PeerProfile> order = new TreeSet<PeerProfile>(mode == 2 ? new HashComparator() : new ProfileComparator()); 46 46 int older = 0; … … 67 67 order.add(prof); 68 68 } 69 69 70 70 int fast = 0; 71 71 int reliable = 0; … … 100 100 for (PeerProfile prof : order) { 101 101 Hash peer = prof.getPeer(); 102 102 103 103 int tier = 0; 104 104 boolean isIntegrated = false; … … 114 114 tier = 3; 115 115 } 116 116 117 117 if (_organizer.isWellIntegrated(peer)) { 118 118 isIntegrated = true; 119 119 integrated++; 120 120 } 121 121 122 122 if (tier != prevTier) 123 123 buf.append("<tr><td colspan=\"8\"><hr></td></tr>\n"); 124 124 prevTier = tier; 125 125 126 126 buf.append("<tr><td align=\"center\" nowrap>"); 127 127 buf.append(_context.commSystem().renderPeerHTML(peer)); … … 130 130 // buf.append(" ** "); 131 131 buf.append("</td><td align=\"center\">"); 132 132 133 133 switch (tier) { 134 134 case 1: buf.append(_t("Fast, High Capacity")); break; … … 180 180 buf.append(' ').append(fails).append('/').append(total).append(' ').append(_t("Test Fails")); 181 181 } 182 182 183 buf.append(" </td>"); 183 184 //buf.append("<td nowrap align=\"center\"><a target=\"_blank\" href=\"dumpprofile.jsp?peer=") … … 344 345 out.flush(); 345 346 } 346 347 347 348 private class ProfileComparator extends HashComparator { 348 349 public int compare(PeerProfile left, PeerProfile right) { … … 381 382 } 382 383 } 383 384 384 385 /** 385 386 * Used for floodfill-only page … … 391 392 return DataHelper.compareTo(left.getPeer().getData(), right.getPeer().getData()); 392 393 } 393 394 } 395 394 395 } 396 396 397 private final static DecimalFormat _fmt = new DecimalFormat("###,##0.00"); 397 398 private final static String num(double num) { synchronized (_fmt) { return _fmt.format(num); } } -
apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java
r5353fd9 rb6c6a5d 78 78 public String getIdent() { 79 79 if (_context == null) return "[no router]"; 80 80 81 81 if (_context.routerHash() != null) 82 82 return _context.routerHash().toBase64().substring(0, 4); … … 97 97 public String getUptime() { 98 98 if (_context == null) return "[no router]"; 99 99 100 100 Router router = _context.router(); 101 101 if (router == null) … … 104 104 return DataHelper.formatDuration2(router.getUptime()); 105 105 } 106 106 107 107 /** 108 108 this displayed offset, not skew - now handled in reachability() … … 119 119 } 120 120 **/ 121 121 122 122 /** allowReseed */ 123 123 public boolean allowReseed() { … … 126 126 _context.getBooleanProperty("i2p.alwaysAllowReseed"); 127 127 } 128 128 129 129 /** subtract one for ourselves, so if we know no other peers it displays zero */ 130 130 public int getAllPeers() { return Math.max(_context.netDb().getKnownRouters() - 1, 0); } 131 131 132 132 public String getReachability() { 133 133 return reachability(); // + timeSkew(); … … 216 216 } 217 217 } 218 218 219 219 /** 220 220 * Retrieve amount of used memory. … … 229 229 } 230 230 ********/ 231 231 232 232 /** 233 233 * How many peers we are talking to now … … 327 327 _context.bandwidthLimiter().getSendBps()); 328 328 } 329 329 330 330 /** 331 331 * @return "x.xx / y.yy {K|M}" … … 334 334 if (_context == null) 335 335 return "0 / 0"; 336 336 337 337 RateStat receiveRate = _context.statManager().getRate("bw.recvRate"); 338 338 double in = 0; … … 351 351 return formatPair(in, out); 352 352 } 353 353 354 354 /** 355 355 * @return "x.xx / y.yy {K|M}" … … 358 358 if (_context == null) 359 359 return "0 / 0"; 360 360 361 361 RateStat receiveRate = _context.statManager().getRate("bw.recvRate"); 362 362 double in; … … 373 373 return formatPair(in, out); 374 374 } 375 375 376 376 /** 377 377 * @return "x.xx / y.yy {K|M}" … … 407 407 if (_context == null) 408 408 return "0"; 409 409 410 410 long received = _context.bandwidthLimiter().getTotalAllocatedInboundBytes(); 411 411 412 412 return DataHelper.formatSize2(received) + 'B'; 413 413 } 414 414 415 415 /** 416 416 * How much data have we sent since the router started (pretty printed … … 421 421 if (_context == null) 422 422 return "0"; 423 423 424 424 long sent = _context.bandwidthLimiter().getTotalAllocatedOutboundBytes(); 425 425 return DataHelper.formatSize2(sent) + 'B'; 426 426 } 427 427 428 428 /** 429 429 * Client destinations connected locally. … … 434 434 // convert the set to a list so we can sort by name and not lose duplicates 435 435 List<Destination> clients = new ArrayList<Destination>(_context.clientManager().listClients()); 436 436 437 437 StringBuilder buf = new StringBuilder(512); 438 438 buf.append("<h3><a href=\"/i2ptunnelmgr\" target=\"_top\" title=\"") … … 443 443 Collections.sort(clients, new AlphaComparator()); 444 444 buf.append("<table id=\"sb_localtunnels\">"); 445 445 446 446 for (Destination client : clients) { 447 447 String name = getName(client); 448 448 Hash h = client.calculateHash(); 449 449 450 450 buf.append("<tr><td align=\"right\"><img src=\"/themes/console/images/"); 451 451 if (_context.clientManager().shouldPublishLeaseSet(h)) … … 464 464 long timeToExpire = ls.getEarliestLeaseDate() - _context.clock().now(); 465 465 if (timeToExpire < 0) { 466 // red or yellow light 466 // red or yellow light 467 467 buf.append("<td><img src=\"/themes/console/images/local_inprogress.png\" alt=\"").append(_t("Rebuilding")).append("…\" title=\"").append(_t("Leases expired")).append(" ").append(DataHelper.formatDuration2(0-timeToExpire)); 468 buf.append(" ").append(_t("ago")).append(". ").append(_t("Rebuilding")).append("…\"></td></tr>\n"); 468 buf.append(" ").append(_t("ago")).append(". ").append(_t("Rebuilding")).append("…\"></td></tr>\n"); 469 469 } else { 470 470 // green light … … 482 482 return buf.toString(); 483 483 } 484 484 485 485 /** 486 486 * Compare translated nicknames - put "shared clients" first in the sort … … 530 530 return _context.tunnelManager().getFreeTunnelCount(); 531 531 } 532 532 533 533 /** 534 534 * How many active outbound tunnels we have. … … 541 541 return _context.tunnelManager().getOutboundTunnelCount(); 542 542 } 543 543 544 544 /** 545 545 * How many inbound client tunnels we have. … … 552 552 return _context.tunnelManager().getInboundClientTunnelCount(); 553 553 } 554 554 555 555 /** 556 556 * How many active outbound client tunnels we have. … … 563 563 return _context.tunnelManager().getOutboundClientTunnelCount(); 564 564 } 565 565 566 566 /** 567 567 * How many tunnels we are participating in. … … 592 592 if (_context == null) 593 593 return "0"; 594 594 595 595 RateStat rs = _context.statManager().getRate("jobQueue.jobLag"); 596 596 if (rs == null) … … 604 604 * (pretty printed with the units attached) 605 605 * 606 */ 606 */ 607 607 public String getMessageDelay() { 608 608 if (_context == null) 609 609 return "0"; 610 610 611 611 return DataHelper.formatDuration2(_context.throttle().getMessageDelay()); 612 612 } 613 613 614 614 /** 615 615 * How long it takes us to test our tunnels, averaged over the last 10 minutes … … 620 620 if (_context == null) 621 621 return "0"; 622 622 623 623 return DataHelper.formatDuration2(_context.throttle().getTunnelLag()); 624 624 } 625 625 626 626 public String getTunnelStatus() { 627 627 if (_context == null) … … 629 629 return _context.throttle().getTunnelStatus(); 630 630 } 631 631 632 632 public String getInboundBacklog() { 633 633 if (_context == null) 634 634 return "0"; 635 635 636 636 return String.valueOf(_context.tunnelManager().getInboundBuildQueueSize()); 637 637 } 638 638 639 639 /******* 640 640 public String getPRNGStatus() {
Note: See TracChangeset
for help on using the changeset viewer.