merge of 'afee8fe3ed03c61266ad369b5ce5408382948977'

and 'cec49ea3b0b9120ba6e58435852fb18c06912c55'
This commit is contained in:
walking
2009-12-13 06:39:05 +00:00
3 changed files with 20 additions and 2 deletions

View File

@ -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);

View File

@ -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

View File

@ -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;