diff --git a/apps/routerconsole/java/bundle-messages.sh b/apps/routerconsole/java/bundle-messages.sh index 879c86089..c72b33ab7 100755 --- a/apps/routerconsole/java/bundle-messages.sh +++ b/apps/routerconsole/java/bundle-messages.sh @@ -40,7 +40,10 @@ ROUTERFILES="\ ../../../router/java/src/net/i2p/router/transport/GetBidsJob.java \ ../../../router/java/src/net/i2p/router/Blocklist.java \ ../../../router/java/src/net/i2p/router/transport/ntcp/EstablishState.java \ - ../../../router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java" + ../../../router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java \ + ../../../router/java/src/net/i2p/router/transport/CommSystemFacadeImpl.java \ + ../../../router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java \ + ../../../router/java/src/net/i2p/router/transport/udp/UDPTransport.java" # add ../java/ so the refs will work in the po file JPATHS="../java/src ../jsp/WEB-INF ../java/strings $JFILE $ROUTERFILES" diff --git a/history.txt b/history.txt index 4e7971b9a..082e117aa 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,9 @@ +2010-04-27 zzz + * i2psnark: Serve downloaded files from the servlet rather + than with a file: link + * Jetty: Backport directory listing bugfix from jetty 6 + * peers.jsp: Cleanup and tag + * 2010-04-27 0.7.13 released 2010-04-23 zzz diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index a411b0099..87e5bffca 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 = 0; + public final static long BUILD = 1; /** for example "-test" */ public final static String EXTRA = ""; diff --git a/router/java/src/net/i2p/router/transport/CommSystemFacadeImpl.java b/router/java/src/net/i2p/router/transport/CommSystemFacadeImpl.java index d8480be1e..50fdd8ddc 100644 --- a/router/java/src/net/i2p/router/transport/CommSystemFacadeImpl.java +++ b/router/java/src/net/i2p/router/transport/CommSystemFacadeImpl.java @@ -495,7 +495,7 @@ public class CommSystemFacadeImpl extends CommSystemFacade { buf.append(""); boolean found = _context.netDb().lookupRouterInfoLocally(peer) != null; if (found) - buf.append(""); + buf.append(""); buf.append(h); if (found) buf.append(""); @@ -503,6 +503,13 @@ public class CommSystemFacadeImpl extends CommSystemFacade { return buf.toString(); } + /** + * Translate + */ + private final String _(String s) { + return Translate.getString(s, _context, BUNDLE_NAME); + } + /* * Timestamper stuff * diff --git a/router/java/src/net/i2p/router/transport/TransportManager.java b/router/java/src/net/i2p/router/transport/TransportManager.java index fdbcc54b4..a479ad52f 100644 --- a/router/java/src/net/i2p/router/transport/TransportManager.java +++ b/router/java/src/net/i2p/router/transport/TransportManager.java @@ -32,6 +32,7 @@ import net.i2p.router.RouterContext; import net.i2p.router.transport.ntcp.NTCPTransport; import net.i2p.router.transport.udp.UDPTransport; import net.i2p.util.Log; +import net.i2p.util.Translate; public class TransportManager implements TransportEventListener { private Log _log; @@ -499,13 +500,14 @@ public class TransportManager implements TransportEventListener { t.renderStatusHTML(out, urlBase, sortFlags); } StringBuilder buf = new StringBuilder(4*1024); - buf.append("

Router Transport Addresses

\n");
+        buf.append("

").append(_("Router Transport Addresses")).append("

\n");
         for (int i = 0; i < _transports.size(); i++) {
             Transport t = _transports.get(i);
             if (t.getCurrentAddress() != null)
-                buf.append(t.getCurrentAddress()).append("\n\n");
+                buf.append(t.getCurrentAddress());
             else
-                buf.append(t.getStyle()).append(" is used for outbound connections only\n\n");
+                buf.append(_("{0} is used for outbound connections only", t.getStyle()));
+            buf.append("\n\n");
         }
         buf.append("
\n"); out.write(buf.toString()); @@ -525,4 +527,20 @@ public class TransportManager implements TransportEventListener { return s; } + + private static final String BUNDLE_NAME = "net.i2p.router.web.messages"; + + /** + * Translate + */ + private final String _(String s) { + return Translate.getString(s, _context, BUNDLE_NAME); + } + + /** + * Translate + */ + private final String _(String s, Object o) { + return Translate.getString(s, o, _context, BUNDLE_NAME); + } } diff --git a/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java b/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java index 190954754..779fd97e4 100644 --- a/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java +++ b/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java @@ -28,6 +28,7 @@ import net.i2p.router.transport.Transport; import net.i2p.router.transport.TransportBid; import net.i2p.router.transport.TransportImpl; import net.i2p.util.Log; +import net.i2p.util.Translate; /** * @@ -687,78 +688,76 @@ public class NTCPTransport extends TransportImpl { long totalRecv = 0; StringBuilder buf = new StringBuilder(512); - buf.append("

NTCP connections: ").append(peers.size()); - buf.append(". Limit: ").append(getMaxConnections()); - buf.append(". Timeout: ").append(DataHelper.formatDuration(_pumper.getIdleTimeout())); + buf.append("

").append(_("NTCP connections")).append(": ").append(peers.size()); + buf.append(". ").append(_("Limit")).append(": ").append(getMaxConnections()); + buf.append(". ").append(_("Timeout")).append(": ").append(DataHelper.formatDuration(_pumper.getIdleTimeout())); buf.append(".

\n" + "\n" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + //"" + " \n"); out.write(buf.toString()); buf.setLength(0); for (Iterator iter = peers.iterator(); iter.hasNext(); ) { NTCPConnection con = (NTCPConnection)iter.next(); - buf.append("\n"); out.write(buf.toString()); buf.setLength(0); @@ -766,13 +765,12 @@ public class NTCPTransport extends TransportImpl { if (peers.size() > 0) { // buf.append("\n"); - buf.append("\n"); + buf.append("\n"); } buf.append("
PeerDirIdleIn/OutUpSkewTXRXOut queueBacklogged?Reading?
").append(_("Peer")).append("").append(_("Dir")).append("").append(_("Idle")).append("").append(_("In/Out")).append("").append(_("Up")).append("").append(_("Skew")).append("").append(_("TX")).append("").append(_("RX")).append("").append(_("Out Queue")).append("").append(_("Backlogged?")).append("").append(_("Reading?")).append("
"); + buf.append("
"); buf.append(_context.commSystem().renderPeerHTML(con.getRemotePeer().calculateHash())); //byte[] ip = getIP(con.getRemotePeer().calculateHash()); //if (ip != null) // buf.append(' ').append(_context.blocklist().toStr(ip)); - buf.append(" "); + buf.append(""); if (con.isInbound()) - buf.append("\"Inbound\""); + buf.append("\"Inbound\""); else - buf.append("\"Outbound\""); - buf.append(" "); + buf.append("\"Outbound\""); + buf.append(""); buf.append(con.getTimeSinceReceive()/1000); - buf.append("s/").append(con.getTimeSinceSend()/1000); - buf.append("s "); + buf.append("s / ").append(con.getTimeSinceSend()/1000); + buf.append("s"); if (con.getTimeSinceReceive() < 10*1000) { buf.append(formatRate(con.getRecvRate()/1024)); bpsRecv += con.getRecvRate(); } else { buf.append(formatRate(0)); } - buf.append("/"); + buf.append(" / "); if (con.getTimeSinceSend() < 10*1000) { buf.append(formatRate(con.getSendRate()/1024)); bpsSend += con.getSendRate(); } else { buf.append(formatRate(0)); } - buf.append("K/s"); - buf.append(" ").append(DataHelper.formatDuration(con.getUptime())); + //buf.append(" K/s"); + buf.append("").append(DataHelper.formatDuration(con.getUptime())); totalUptime += con.getUptime(); offsetTotal = offsetTotal + con.getClockSkew(); - buf.append(" ").append(con.getClockSkew()); - buf.append("s ").append(con.getMessagesSent()); + buf.append("").append(con.getClockSkew()); + buf.append("s").append(con.getMessagesSent()); totalSend += con.getMessagesSent(); - buf.append(" ").append(con.getMessagesReceived()); + buf.append("").append(con.getMessagesReceived()); totalRecv += con.getMessagesReceived(); long outQueue = con.getOutboundQueueSize(); - if (outQueue <= 0) { - buf.append(" No messages"); - } else { - buf.append(" ").append(outQueue).append(" message"); - if (outQueue > 1) - buf.append("s"); - } - buf.append(" ").append(con.getConsecutiveBacklog() > 0 ? "true" : "false"); - long readTime = con.getReadTime(); - if (readTime <= 0) { - buf.append(" No"); - } else { - buf.append(" For ").append(DataHelper.formatDuration(readTime)); - } + buf.append("").append(outQueue); + buf.append(""); + if (con.getConsecutiveBacklog() > 0) + buf.append("✓"); + else + buf.append(" "); + //long readTime = con.getReadTime(); + //if (readTime <= 0) { + // buf.append(" 0"); + //} else { + // buf.append(" ").append(DataHelper.formatDuration(readTime)); + //} buf.append("

").append(peers.size()).append(" peers    "); - buf.append(" ").append(formatRate(bpsRecv/1024)).append("/").append(formatRate(bpsSend/1024)).append("K/s"); - buf.append(" ").append(DataHelper.formatDuration(totalUptime/peers.size())); - buf.append(" ").append(peers.size() > 0 ? DataHelper.formatDuration(offsetTotal*1000/peers.size()) : "0ms"); - buf.append(" ").append(totalSend).append(" ").append(totalRecv); - buf.append("      " + - "
").append(peers.size()).append(' ').append(_("peers")).append("  "); + buf.append("").append(formatRate(bpsRecv/1024)).append("/").append(formatRate(bpsSend/1024)).append(""); + buf.append("").append(DataHelper.formatDuration(totalUptime/peers.size())); + buf.append("").append(peers.size() > 0 ? DataHelper.formatDuration(offsetTotal*1000/peers.size()) : "0ms"); + buf.append("").append(totalSend).append("").append(totalRecv); + buf.append("  
\n"); @@ -818,6 +816,15 @@ public class NTCPTransport extends TransportImpl { } } + private static final String BUNDLE_NAME = "net.i2p.router.web.messages"; + + /** + * Translate + */ + private final String _(String s) { + return Translate.getString(s, _context, BUNDLE_NAME); + } + /** * Cache the bid to reduce object churn */ diff --git a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java index fd0e5c9e4..ed6a64789 100644 --- a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java +++ b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java @@ -37,6 +37,7 @@ import net.i2p.util.ConcurrentHashSet; import net.i2p.util.Log; import net.i2p.util.SimpleScheduler; import net.i2p.util.SimpleTimer; +import net.i2p.util.Translate; /** * @@ -717,11 +718,11 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority RemoteHostId remoteId = peer.getRemoteHostId(); if (remoteId == null) return false; - oldPeer = _peersByRemoteHost.put(remoteId, peer); - if ( (oldPeer != null) && (oldPeer != peer) ) { - // transfer over the old state/inbound message fragments/etc - peer.loadFrom(oldPeer); - oldEstablishedOn = oldPeer.getKeyEstablishedTime(); + oldPeer = _peersByRemoteHost.put(remoteId, peer); + if ( (oldPeer != null) && (oldPeer != peer) ) { + // transfer over the old state/inbound message fragments/etc + peer.loadFrom(oldPeer); + oldEstablishedOn = oldPeer.getKeyEstablishedTime(); } if (oldPeer != null) { @@ -1834,17 +1835,22 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority } } - private void appendSortLinks(StringBuilder buf, String urlBase, int sortFlags, String descr, int ascending) { - if (sortFlags == ascending) { + private static void appendSortLinks(StringBuilder buf, String urlBase, int sortFlags, String descr, int ascending) { + if (ascending == FLAG_ALPHA) { // 0 + buf.append(" \"V\""); + } else if (sortFlags == ascending) { buf.append(" V^ "); + buf.append("#udpcon\" title=\"").append(descr).append("\">\"V\"" + + "\"^\""); } else if (sortFlags == 0 - ascending) { - buf.append(" V^ "); + buf.append(" \"V\"\"^\""); } else { buf.append(" V^ "); + buf.append("#udpcon\" title=\"").append(descr).append("\">\"V\"" + + "\"^\""); } } @@ -1869,54 +1875,55 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority int numPeers = 0; StringBuilder buf = new StringBuilder(512); - buf.append("

UDP connections: ").append(peers.size()); - buf.append(". Limit: ").append(getMaxConnections()); - buf.append(". Timeout: ").append(DataHelper.formatDuration(_expireTimeout)); + buf.append("

").append(_("UDP connections")).append(": ").append(peers.size()); + buf.append(". ").append(_("Limit")).append(": ").append(getMaxConnections()); + buf.append(". ").append(_("Timeout")).append(": ").append(DataHelper.formatDuration(_expireTimeout)); buf.append(".

\n"); buf.append("\n"); - buf.append(""); - buf.append("\n"); - buf.append("\n"); - buf.append("\n"); - buf.append("\n"); - buf.append("\n"); - buf.append("\n"); - buf.append("\n"); + buf.append("\n"); out.write(buf.toString()); buf.setLength(0); long now = _context.clock().now(); @@ -1925,37 +1932,34 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority if (now-peer.getLastReceiveTime() > 60*60*1000) continue; // don't include old peers - buf.append(""); int recvBps = (idleIn > 2 ? 0 : peer.getReceiveBps()); int sendBps = (idleOut > 2 ? 0 : peer.getSendBps()); - buf.append(" "); - buf.append(" "); offsetTotal = offsetTotal + peer.getClockSkew(); long sendWindow = peer.getSendWindowBytes(); - buf.append(" "); - buf.append(" "); int rtt = peer.getRTT(); int rto = peer.getRTO(); - buf.append(" "); - buf.append(" "); - buf.append(" "); - buf.append(" "); - buf.append(" "); @@ -2055,14 +2059,14 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority long resent = peer.getPacketsRetransmitted(); long dupRecv = peer.getPacketsReceivedDuplicate(); - buf.append(" "); double recvDupPct = (double)peer.getPacketsReceivedDuplicate()/(double)peer.getPacketsReceived(); - buf.append(" "); @@ -2087,24 +2091,24 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority } // buf.append("\n"); - buf.append(" "); - buf.append(" "); - buf.append(" \n"); - buf.append(" " + + "" + + "\n" + + "\n"); - buf.append(" \n" + + "\n \n"); - buf.append(" \n"); - buf.append("
Peer"); + buf.append("
").append(_("Peer")).append("
"); if (sortFlags != FLAG_ALPHA) - buf.append(" V "); - buf.append("
DirIdle
"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by idle inbound", FLAG_IDLE_IN); - buf.append("/"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by idle outbound", FLAG_IDLE_OUT); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by peer hash"), FLAG_ALPHA); + buf.append("
").append(_("Dir")) + .append("").append(_("Idle")).append("
"); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by idle inbound"), FLAG_IDLE_IN); + buf.append(" / "); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by idle outbound"), FLAG_IDLE_OUT); buf.append("
In/Out
"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by inbound rate", FLAG_RATE_IN); - buf.append("/"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by outbound rate", FLAG_RATE_OUT); + buf.append("
").append(_("In/Out")).append("
"); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by inbound rate"), FLAG_RATE_IN); + buf.append(" / "); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by outbound rate"), FLAG_RATE_OUT); buf.append("
Up
"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by connection uptime", FLAG_UPTIME); - buf.append("
Skew
"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by clock skew", FLAG_SKEW); + buf.append("
").append(_("Up")).append("
"); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by connection uptime"), FLAG_UPTIME); + buf.append("
").append(_("Skew")).append("
"); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by clock skew"), FLAG_SKEW); buf.append("
Cwnd
"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by congestion window", FLAG_CWND); - buf.append("
Sst
"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by slow start threshold", FLAG_SSTHRESH); + buf.append("
CWND
"); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by congestion window"), FLAG_CWND); + buf.append("
SST
"); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by slow start threshold"), FLAG_SSTHRESH); buf.append("
Rtt
"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by round trip time", FLAG_RTT); - buf.append("
Dev
"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by round trip time deviation", FLAG_DEV); - buf.append("
Rto
"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by retransmission timeout", FLAG_RTO); + buf.append("
RTT
"); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by round trip time"), FLAG_RTT); + buf.append("
").append(_("Dev")).append("
"); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by round trip time deviation"), FLAG_DEV); + buf.append("
RTO
"); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by retransmission timeout"), FLAG_RTO); buf.append("
Mtu
"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by maximum transmit unit", FLAG_MTU); - buf.append("
TX
"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by packets sent", FLAG_SEND); - buf.append("
RX
"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by packets received", FLAG_RECV); + buf.append("
MTU
"); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by outbound maximum transmit unit"), FLAG_MTU); + buf.append("
").append(_("TX")).append("
"); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by packets sent"), FLAG_SEND); + buf.append("
").append(_("RX")).append("
"); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by packets received"), FLAG_RECV); buf.append("
ReTX
"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by packets retransmitted", FLAG_RESEND); - buf.append("
DupRX
"); - appendSortLinks(buf, urlBase, sortFlags, "Sort by packets received more than once", FLAG_DUP); - buf.append("
").append(_("Dup TX")).append("
"); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by packets retransmitted"), FLAG_RESEND); + buf.append("
").append(_("Dup RX")).append("
"); + appendSortLinks(buf, urlBase, sortFlags, _("Sort by packets received more than once"), FLAG_DUP); + buf.append("
"); + buf.append("
"); buf.append(_context.commSystem().renderPeerHTML(peer.getRemotePeer())); //byte ip[] = peer.getRemoteIP(); //if (ip != null) // buf.append(' ').append(_context.blocklist().toStr(ip)); - buf.append(" "); + buf.append(""); if (peer.isInbound()) - buf.append("\"Inbound\" "); + buf.append("\"Inbound\""); else - buf.append("\"Outbound\" "); + buf.append("\"Outbound\""); if (peer.getWeRelayToThemAs() > 0) - buf.append("^"); - else - buf.append(" "); + buf.append("  \"^\""); if (peer.getTheyRelayToUsAs() > 0) - buf.append("v"); + buf.append("  \"V\""); boolean appended = false; if (_activeThrottle.isChoked(peer.getRemotePeer())) { - if (!appended) buf.append("
"); - buf.append(" Choked"); + buf.append("
").append(_("Choked")).append(""); appended = true; } if (peer.getConsecutiveFailedSends() > 0) { if (!appended) buf.append("
"); - buf.append(" ").append(peer.getConsecutiveFailedSends()).append(" fail(s)"); + buf.append(" ").append(peer.getConsecutiveFailedSends()).append(' ').append(_("fail(s)")).append(""); appended = true; } if (_context.shitlist().isShitlisted(peer.getRemotePeer(), STYLE)) { if (!appended) buf.append("
"); - buf.append(" Banned"); + buf.append(" ").append(_("Banned")).append(""); appended = true; } //byte[] ip = getIP(peer.getRemotePeer()); @@ -1968,20 +1972,20 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority if (idleIn < 0) idleIn = 0; if (idleOut < 0) idleOut = 0; - buf.append("
"); + buf.append(""); buf.append(idleIn); - buf.append("s/"); + buf.append("s / "); buf.append(idleOut); buf.append("s"); + buf.append(""); buf.append(formatKBps(recvBps)); - buf.append("/"); + buf.append(" / "); buf.append(formatKBps(sendBps)); - buf.append("K/s "); + //buf.append(" K/s"); //buf.append(formatKBps(peer.getReceiveACKBps())); //buf.append("K/s/"); //buf.append(formatKBps(peer.getSendACKBps())); @@ -1990,46 +1994,46 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority long uptime = now - peer.getKeyEstablishedTime(); - buf.append(" "); + buf.append(""); buf.append(DataHelper.formatDuration(uptime)); buf.append(""); + buf.append(""); buf.append(peer.getClockSkew() / 1000); buf.append("s"); + buf.append(""); buf.append(sendWindow/1024); buf.append("K"); - buf.append("/").append(peer.getConcurrentSends()); - buf.append("/").append(peer.getConcurrentSendWindow()); - buf.append("/").append(peer.getConsecutiveSendRejections()); + buf.append(" / ").append(peer.getConcurrentSends()); + buf.append(" / ").append(peer.getConcurrentSendWindow()); + buf.append(" / ").append(peer.getConsecutiveSendRejections()); buf.append(""); + buf.append(""); buf.append(peer.getSlowStartThreshold()/1024); buf.append("K"); + buf.append(""); buf.append(rtt); buf.append(""); + buf.append(""); buf.append(peer.getRTTDeviation()); buf.append(""); + buf.append(""); buf.append(rto); buf.append(""); - buf.append(peer.getMTU()).append("/").append(peer.getReceiveMTU()); + buf.append(""); + buf.append(peer.getMTU()).append(" / ").append(peer.getReceiveMTU()); //.append('/'); //buf.append(peer.getMTUIncreases()).append('/'); @@ -2039,11 +2043,11 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority long sent = peer.getPacketsTransmitted(); long recv = peer.getPacketsReceived(); - buf.append(" "); + buf.append(""); buf.append(sent); buf.append(""); + buf.append(""); buf.append(recv); buf.append(""); + buf.append(""); //buf.append(formatPct(sendLostPct)); buf.append(resent); // + "/" + peer.getPacketsPeriodRetransmitted() + "/" + sent); //buf.append(peer.getPacketRetransmissionRate()); buf.append(""); + buf.append(""); buf.append(dupRecv); //formatPct(recvDupPct)); buf.append("

Total"); - buf.append(formatKBps(bpsIn)).append("/").append(formatKBps(bpsOut)); - buf.append("K/s").append(numPeers > 0 ? DataHelper.formatDuration(uptimeMsTotal/numPeers) : "0s"); - buf.append(" ").append(numPeers > 0 ? DataHelper.formatDuration(offsetTotal/numPeers) : "0ms").append(""); + buf.append("
").append(_("SUMMARY")).append(""); + buf.append(formatKBps(bpsIn)).append(" / ").append(formatKBps(bpsOut)); + buf.append("").append(numPeers > 0 ? DataHelper.formatDuration(uptimeMsTotal/numPeers) : "0s"); + buf.append("").append(numPeers > 0 ? DataHelper.formatDuration(offsetTotal/numPeers) : "0ms").append(""); buf.append(numPeers > 0 ? cwinTotal/(numPeers*1024) + "K" : "0K"); - buf.append("  "); + buf.append(" "); buf.append(numPeers > 0 ? rttTotal/numPeers : 0); - buf.append("   "); + buf.append("  "); buf.append(numPeers > 0 ? rtoTotal/numPeers : 0); - buf.append("  "); - buf.append(sendTotal).append(" ").append(recvTotal).append("").append(resentTotal); - buf.append(" ").append(dupRecvTotal).append("
\n"); + buf.append("  "); + buf.append(sendTotal).append(" ").append(recvTotal).append("\n" + + "").append(resentTotal); + buf.append("").append(dupRecvTotal).append("\n" + + "

\n"); /***** long bytesTransmitted = _context.bandwidthLimiter().getTotalAllocatedOutboundBytes(); @@ -2120,7 +2124,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority out.write(buf.toString()); buf.setLength(0); - out.write(KEY); + out.write(getKey()); } private static final DecimalFormat _fmt = new DecimalFormat("#,##0.00"); @@ -2136,28 +2140,48 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority } } - private static final String KEY = "

Definitions

" + - "

Peer: the remote peer.
\n" + - "Dir: v means they offer to introduce us, ^ means we offer to introduce them.
\n" + - "Idle: the idle time is how long since a packet has been received or sent.
\n" + - "In/out: the rates show a smoothed inbound and outbound transfer rate (KBytes per second).
\n" + - "Up: the uptime is how long ago this session was established.
\n" + - "Skew: the skew says how far off the other user's clock is, relative to your own.
\n" + - "Cwnd: the congestion window is how many bytes in 'in flight' you can send w/out an acknowledgement, /
\n" + - "        the number of currently active messages being sent, /
\n" + - "        the maximum number of concurrent messages to send, /
\n"+ - "        the number of consecutive sends which were blocked due to throws message window size.
\n" + - "Sst: the slow start threshold helps make sure the cwnd doesn't grow too fast.
\n" + - "Rtt: the round trip time is how long it takes to get an acknowledgement of a packet.
\n" + - "Dev: the standard deviation of the round trip time, to help control the retransmit timeout.
\n" + - "Rto: the retransmit timeout controls how frequently an unacknowledged packet will be retransmitted.
\n" + - "Mtu: current sending packet size / estimated receiving packet size.
\n" + - "TX: the number of packets sent to the peer.
\n" + - "RX: the number of packets received from the peer.
\n" + - "ReTX: the number of packets retransmitted to the peer.
\n" + - "DupRX: the number of duplicate packets received from the peer.

" + - "
\n"; + private final String getKey() { + StringBuilder buf = new StringBuilder(1024); + buf.append("

").append(_("Definitions")).append("

" + + "

").append(_("Peer")).append(": ").append(_("The remote peer, identified by router hash")).append("
\n" + + "").append(_("Dir")).append(": " + + " ").append(_("Inbound connection")).append("
\n" + + "       " + + " ").append(_("Outbound connection")).append("
\n" + + "       " + + "\"V\" ").append(_("They offered to introduce us (help other peers traverse our firewall)")).append("
\n" + + "       " + + "\"^\" ").append(_("We offered to introduce them (help other peers traverse their firewall)")).append("
\n" + + "").append(_("Idle")).append(": ").append(_("How long since a packet has been received / sent")).append("
\n" + + "").append(_("In/Out")).append(": ").append(_("The smoothed inbound / outbound transfer rate (KBytes per second)")).append("
\n" + + "").append(_("Up")).append(": ").append(_("How long ago this connection was established")).append("
\n" + + "").append(_("Skew")).append(": ").append(_("The difference between the peer's clock and your own")).append("
\n" + + "CWND: ").append(_("The congestion window, which is how many bytes can be sent without an acknowledgement")).append(" /
\n" + + "        ").append(_("The number of sent messages awaiting acknowledgement")).append(" /
\n" + + "        ").append(_("The maximum number of concurrent messages to send")).append(" /
\n"+ + "        ").append(_("The number of pending sends which exceed congestion window")).append("
\n" + + "SST: ").append(_("The slow start threshold")).append("
\n" + + "RTT: ").append(_("The round trip time in milliseconds")).append("
\n" + + "").append(_("Dev")).append(": ").append(_("The standard deviation of the round trip time in milliseconds")).append("
\n" + + "RTO: ").append(_("The retransmit timeout in milliseconds")).append("
\n" + + "MTU: ").append(_("Current maximum send packet size / estimated maximum receive packet size (bytes)")).append("
\n" + + "").append(_("TX")).append(": ").append(_("The total number of packets sent to the peer")).append("
\n" + + "").append(_("RX")).append(": ").append(_("The total number of packets received from the peer")).append("
\n" + + "").append(_("Dup TX")).append(": ").append(_("The total number of packets retransmitted to the peer")).append("
\n" + + "").append(_("Dup RX")).append(": ").append(_("The total number of duplicate packets received from the peer")).append("

" + + "
\n"); + return buf.toString(); + } + private static final String BUNDLE_NAME = "net.i2p.router.web.messages"; + + /** + * Translate + */ + private final String _(String s) { + return Translate.getString(s, _context, BUNDLE_NAME); + } + /* * Cache the bid to reduce object churn */ @@ -2378,6 +2402,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority } } +/******* private static final String BADIPS[] = new String[] { "192.168.0.1", "127.0.0.1", "10.3.4.5", "172.16.3.4", "224.5.6.7" }; private static final String GOODIPS[] = new String[] { "192.167.0.1", "126.0.0.1", "11.3.4.5", "172.15.3.4", "223.5.6.7" }; public static void main(String args[]) { @@ -2396,4 +2421,5 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority } catch (Exception e) { e.printStackTrace(); } } } +*******/ }