diff --git a/apps/routerconsole/java/src/net/i2p/router/web/TunnelRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/TunnelRenderer.java index 9091e072f308b034f7542ad1bb2461171ab48b86..74a585d48a09080d9e6be76b4c285378de510717 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/TunnelRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/TunnelRenderer.java @@ -23,6 +23,7 @@ import net.i2p.router.TunnelInfo; import net.i2p.router.TunnelPoolSettings; import net.i2p.router.tunnel.HopConfig; import net.i2p.router.tunnel.pool.TunnelPool; +import net.i2p.router.CommSystemFacade; import net.i2p.stat.RateStat; import net.i2p.util.ObjectCounter; @@ -229,7 +230,7 @@ public class TunnelRenderer { Set<Hash> peers = new HashSet(lc.objects()); peers.addAll(pc.objects()); 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("<table><tr><th>" + _("Peer") + "</th><th>" + _("Expl. + Client") + "</th><th>" + _("% of total") + "</th><th>" + _("Part. from + to") + "</th><th>" + _("% of total") + "</th></tr>\n"); @@ -295,6 +296,22 @@ public class TunnelRenderer { return ((Hash)l).toBase64().compareTo(((Hash)r).toBase64()); } } + + 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) { RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer); diff --git a/history.txt b/history.txt index aa9bf922b86828f84b49aabb8d510fc07bdf5f4c..907e71655624610a1e6255986f9201572b1d24d3 100644 --- a/history.txt +++ b/history.txt @@ -1,5 +1,6 @@ 2009-12-12 zzz * Disable InternalSockets until it's fixed + * Sort peers on tunnels.jsp by country 2009-12-11 zzz * Addressbook, susidns: Rework addressbook into a diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index ef84e9e97b23943b36323de092e6e12d02dc671b..e4d51a2bbbc6525a11e0ae2b6866c05bfb2d3470 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 3; + public final static long BUILD = 4; /** for example "-test" */ public final static String EXTRA = ""; public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;