javadoc and logging tweaks; bring back i2ptunnel link to summary bar

This commit is contained in:
zzz
2010-01-06 14:52:53 +00:00
parent d8d50aaf41
commit eaaf6af31d
16 changed files with 67 additions and 42 deletions

View File

@ -12,6 +12,7 @@ import net.i2p.util.Log;
* Listen for in-JVM connections on the internal "socket"
*
* @author zzz
* @since 0.7.9
*/
class InternalSocketRunner implements Runnable {
private I2PTunnelClientBase client;

View File

@ -5,6 +5,7 @@ import net.i2p.util.Translate;
/**
* Translate strings for this package.
* @since 0.7.9
*/
public class Messages {
private static final String BUNDLE_NAME = "net.i2p.i2ptunnel.web.messages";

View File

@ -126,6 +126,13 @@ public class SummaryBarRenderer {
.append(_("Textual router performance statistics"))
.append("\">")
.append(_("Stats"))
.append("</a>\n" +
"<a href=\"/i2ptunnel/index.jsp\" target=\"_blank\" title=\"")
.append(_("Local Destinations"))
.append("\">")
.append(_("I2PTunnel"))
.append("</a></td></tr></table>\n");
out.write(buf.toString());

View File

@ -358,52 +358,58 @@ public class SummaryHelper extends HelperBase {
}
/**
* How many client destinations are connected locally.
* Client destinations connected locally.
*
* @return html section summary
*/
public String getDestinations() {
// covert the set to a list so we can sort by name and not lose duplicates
List clients = new ArrayList(_context.clientManager().listClients());
Collections.sort(clients, new AlphaComparator());
// convert the set to a list so we can sort by name and not lose duplicates
List<Destination> clients = new ArrayList(_context.clientManager().listClients());
StringBuilder buf = new StringBuilder(512);
buf.append("<h3><a href=\"/i2ptunnel/index.jsp\" target=\"_blank\" title=\"").append(_("Add/remove/edit &amp; control your client and server tunnels")).append("\">").append(_("Local Destinations")).append("</a></h3><hr><div class=\"tunnels\"><table>");
for (Iterator iter = clients.iterator(); iter.hasNext(); ) {
Destination client = (Destination)iter.next();
String name = getName(client);
Hash h = client.calculateHash();
buf.append("<h3><a href=\"/i2ptunnel/index.jsp\" target=\"_blank\" title=\"").append(_("Add/remove/edit &amp; control your client and server tunnels")).append("\">").append(_("Local Destinations")).append("</a></h3><hr><div class=\"tunnels\">");
if (clients.size() > 0) {
Collections.sort(clients, new AlphaComparator());
buf.append("<table>");
buf.append("<tr><td align=\"right\"><img src=\"/themes/console/images/");
if (_context.clientManager().shouldPublishLeaseSet(h))
buf.append("server.png\" alt=\"Server\" title=\"" + _("Server") + "\">");
else
buf.append("client.png\" alt=\"Client\" title=\"" + _("Client") + "\">");
buf.append("</td><td align=\"left\"><b><a href=\"tunnels.jsp#").append(h.toBase64().substring(0,4));
buf.append("\" target=\"_top\" title=\"" + _("Show tunnels") + "\">");
if (name.length() < 16)
buf.append(name);
else
buf.append(name.substring(0,15)).append("&hellip;");
buf.append("</a></b></td>\n");
LeaseSet ls = _context.netDb().lookupLeaseSetLocally(h);
if (ls != null) {
long timeToExpire = ls.getEarliestLeaseDate() - _context.clock().now();
if (timeToExpire < 0) {
// red or yellow light
buf.append("<td><img src=\"/themes/console/images/local_inprogress.png\" alt=\"").append(_("Rebuilding")).append("&hellip;\" title=\"").append(_("Leases expired")).append(" ").append(DataHelper.formatDuration(0-timeToExpire));
buf.append(" ").append(_("ago")).append(". ").append(_("Rebuilding")).append("&hellip;\"></td></tr>\n");
for (Iterator<Destination> iter = clients.iterator(); iter.hasNext(); ) {
Destination client = iter.next();
String name = getName(client);
Hash h = client.calculateHash();
buf.append("<tr><td align=\"right\"><img src=\"/themes/console/images/");
if (_context.clientManager().shouldPublishLeaseSet(h))
buf.append("server.png\" alt=\"Server\" title=\"" + _("Server") + "\">");
else
buf.append("client.png\" alt=\"Client\" title=\"" + _("Client") + "\">");
buf.append("</td><td align=\"left\"><b><a href=\"tunnels.jsp#").append(h.toBase64().substring(0,4));
buf.append("\" target=\"_top\" title=\"" + _("Show tunnels") + "\">");
if (name.length() < 16)
buf.append(name);
else
buf.append(name.substring(0,15)).append("&hellip;");
buf.append("</a></b></td>\n");
LeaseSet ls = _context.netDb().lookupLeaseSetLocally(h);
if (ls != null) {
long timeToExpire = ls.getEarliestLeaseDate() - _context.clock().now();
if (timeToExpire < 0) {
// red or yellow light
buf.append("<td><img src=\"/themes/console/images/local_inprogress.png\" alt=\"").append(_("Rebuilding")).append("&hellip;\" title=\"").append(_("Leases expired")).append(" ").append(DataHelper.formatDuration(0-timeToExpire));
buf.append(" ").append(_("ago")).append(". ").append(_("Rebuilding")).append("&hellip;\"></td></tr>\n");
} else {
// green light
buf.append("<td><img src=\"/themes/console/images/local_up.png\" alt=\"Ready\" title=\"").append(_("Ready")).append("\"></td></tr>\n");
}
} else {
// green light
buf.append("<td><img src=\"/themes/console/images/local_up.png\" alt=\"Ready\" title=\"").append(_("Ready")).append("\"></td></tr>\n");
// yellow light
buf.append("<td><img src=\"/themes/console/images/local_inprogress.png\" alt=\"").append(_("Building")).append("&hellip;\" title=\"").append(_("Building tunnels")).append("&hellip;\"></td></tr>\n");
}
} else {
// yellow light
buf.append("<td><img src=\"/themes/console/images/local_inprogress.png\" alt=\"").append(_("Building")).append("&hellip;\" title=\"").append(_("Building tunnels")).append("&hellip;\"></td></tr>\n");
}
buf.append("</table>");
} else {
buf.append("<center><i>").append(_("none")).append("</i></center>");
}
buf.append("</table></div><hr>\n");
buf.append("</div><hr>\n");
return buf.toString();
}

View File

@ -5,6 +5,7 @@ import net.i2p.util.Translate;
/**
* Translate strings for this package.
* @since 0.7.9
*/
public class Messages {
private static final String BUNDLE_NAME = "i2p.susi.dns.messages";

View File

@ -30,6 +30,7 @@ import net.i2p.data.Destination;
* i2p.naming.eepget.list=http://stats.i2p/cgi-bin/hostquery.cgi?a=,http://i2host.i2p/cgi-bin/i2hostquery?
*
* @author zzz
* @since 0.7.9
*/
public class EepGetAndAddNamingService extends EepGetNamingService {

View File

@ -26,6 +26,7 @@ import net.i2p.I2PAppContext;
* that may vanish. If you do use multipe writers,
* you may get intermittent 'write end dead' or 'pipe broken' IOExceptions on the reader side.
* See http://techtavern.wordpress.com/2008/07/16/whats-this-ioexception-write-end-dead/
* @since 0.7.9
*/
public class InternalServerSocket extends ServerSocket {
private static final ConcurrentHashMap<Integer, InternalServerSocket> _sockets = new ConcurrentHashMap(4);

View File

@ -12,6 +12,7 @@ import java.nio.channels.SocketChannel;
* A simple in-JVM Socket using Piped Streams.
* We use port numbers just like regular sockets.
* Can only connect to InternalServerSocket.
* @since 0.7.9
*/
public class InternalSocket extends Socket {
private InputStream _is;

View File

@ -18,6 +18,7 @@ import net.i2p.util.ConcurrentHashSet;
* Support real-time language changing with the routerconsole.lang property.
*
* @author zzz, from a base generated by eclipse.
* @since 0.7.9
*/
public abstract class Translate {
public static final String PROP_LANG = "routerconsole.lang";

View File

@ -1,3 +1,6 @@
2010-01-06 zzz
* Summary bar tweaks
2010-01-02 sponge
* Fix one last stupid mistake in build.xml, my fault.

View File

@ -20,8 +20,8 @@ public class BuildResponseRecord {
* Create a new encrypted response
*
* @param status the response
* @param responseMessageID unused except for debugging
* @param a 528-byte response record
* @param responseMessageId unused except for debugging
* @return a 528-byte response record
*/
public static byte[] create(I2PAppContext ctx, int status, SessionKey replyKey, byte replyIV[], long responseMessageId) {
//Log log = ctx.logManager().getLog(BuildResponseRecord.class);

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 = 16;
public final static long BUILD = 17;
/** for example "-test" */
public final static String EXTRA = "";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;

View File

@ -19,6 +19,7 @@ import net.i2p.util.InternalServerSocket;
* Listen for in-JVM connections on the internal "socket"
*
* @author zzz
* @since 0.7.9
*/
public class InternalClientListenerRunner extends ClientListenerRunner {

View File

@ -22,7 +22,7 @@ import java.util.Set;
*/
public class Addresses {
/** return the first non-local address it finds, or null */
/** @return the first non-local address it finds, or null */
public static String getAnyAddress() {
String[] a = getAddresses();
if (a.length > 0)
@ -31,7 +31,7 @@ public class Addresses {
}
/**
* Return an array of all addresses, excluding
* @return an array of all addresses, excluding
* IPv6, local, broadcast, multicast, etc.
*/
public static String[] getAddresses() {

View File

@ -602,8 +602,8 @@ public class NTCPConnection implements FIFOBandwidthLimiter.CompleteListener {
OutNetMessage msg = null;
synchronized (_outbound) {
if (_currentOutbound != null) {
if (_log.shouldLog(Log.WARN))
_log.warn("attempt for multiple outbound messages with " + System.identityHashCode(_currentOutbound) + " already waiting and " + _outbound.size() + " queued");
if (_log.shouldLog(Log.INFO))
_log.info("attempt for multiple outbound messages with " + System.identityHashCode(_currentOutbound) + " already waiting and " + _outbound.size() + " queued");
return;
}
//throw new RuntimeException("We should not be preparing a write while we still have one pending");

View File

@ -12,6 +12,7 @@ import net.i2p.router.RouterContext;
* Same as PTG, but check to see if a message should be dropped before queueing it.
* Used for IBGWs.
*
* @since 0.7.9
*/
public class ThrottledPumpedTunnelGateway extends PumpedTunnelGateway {
/** saved so we can note messages that get dropped */