sort peers per country
This commit is contained in:
@ -23,6 +23,7 @@ import net.i2p.router.TunnelInfo;
|
|||||||
import net.i2p.router.TunnelPoolSettings;
|
import net.i2p.router.TunnelPoolSettings;
|
||||||
import net.i2p.router.tunnel.HopConfig;
|
import net.i2p.router.tunnel.HopConfig;
|
||||||
import net.i2p.router.tunnel.pool.TunnelPool;
|
import net.i2p.router.tunnel.pool.TunnelPool;
|
||||||
|
import net.i2p.router.CommSystemFacade;
|
||||||
import net.i2p.stat.RateStat;
|
import net.i2p.stat.RateStat;
|
||||||
import net.i2p.util.ObjectCounter;
|
import net.i2p.util.ObjectCounter;
|
||||||
|
|
||||||
@ -229,7 +230,7 @@ public class TunnelRenderer {
|
|||||||
Set<Hash> peers = new HashSet(lc.objects());
|
Set<Hash> peers = new HashSet(lc.objects());
|
||||||
peers.addAll(pc.objects());
|
peers.addAll(pc.objects());
|
||||||
List<Hash> peerList = new ArrayList(peers);
|
List<Hash> peerList = new ArrayList(peers);
|
||||||
Collections.sort(peerList, new HashComparator());
|
Collections.sort(peerList, new CountryComparator(this._context.commSystem()));
|
||||||
|
|
||||||
out.write("<h2><a name=\"peers\"></a>" + _("Tunnel Counts By Peer") + "</h2>\n");
|
out.write("<h2><a name=\"peers\"></a>" + _("Tunnel Counts By Peer") + "</h2>\n");
|
||||||
out.write("<table><tr><th>" + _("Peer") + "</th><th>" + _("Expl. + Client") + "</th><th>" + _("% of total") + "</th><th>" + _("Part. from + to") + "</th><th>" + _("% of total") + "</th></tr>\n");
|
out.write("<table><tr><th>" + _("Peer") + "</th><th>" + _("Expl. + Client") + "</th><th>" + _("% of total") + "</th><th>" + _("Part. from + to") + "</th><th>" + _("% of total") + "</th></tr>\n");
|
||||||
@ -296,6 +297,22 @@ public class TunnelRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class CountryComparator implements Comparator<Hash> {
|
||||||
|
public CountryComparator(CommSystemFacade comm) {
|
||||||
|
this.comm = comm;
|
||||||
|
}
|
||||||
|
public int compare(Hash l, Hash r) {
|
||||||
|
// get both countries
|
||||||
|
String lc = this.comm.getCountry(l);
|
||||||
|
String rc = this.comm.getCountry(r);
|
||||||
|
|
||||||
|
// let String handle the rest
|
||||||
|
return lc.compareTo(rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CommSystemFacade comm;
|
||||||
|
}
|
||||||
|
|
||||||
private String getCapacity(Hash peer) {
|
private String getCapacity(Hash peer) {
|
||||||
RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer);
|
RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer);
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
2009-12-12 zzz
|
2009-12-12 zzz
|
||||||
* Disable InternalSockets until it's fixed
|
* Disable InternalSockets until it's fixed
|
||||||
|
* Sort peers on tunnels.jsp by country
|
||||||
|
|
||||||
2009-12-11 zzz
|
2009-12-11 zzz
|
||||||
* Addressbook, susidns: Rework addressbook into a
|
* Addressbook, susidns: Rework addressbook into a
|
||||||
|
Reference in New Issue
Block a user