Update of /cvsroot/freenet/freenet/src/freenet/client/http
In directory sc8-pr-cvs1:/tmp/cvs-serv25857/src/freenet/client/http
Modified Files:
Tag: stable
ContextManager.java FproxyServlet.java HttpServletRunner.java
InsertServlet_.java NodeStatusServlet.java SFRContext.java
SplitFileRequestServlet.java
Log Message:
5029: Merge from unstable after months of work. MASSIVE changes.
Highlights:
* Next Generation Routing, massive related changes
* Major changes to handling of messages and connections (PeerHandler and related
changes)
* Even more non-blocking I/O
* Documentation improvements
* Lots of new diagnostics and config options
* Lots of bug fixes and performance tweaking
* Probably lots of new bugs too!
Index: ContextManager.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/client/http/ContextManager.java,v
retrieving revision 1.2.4.2.2.2
retrieving revision 1.2.4.2.2.3
diff -u -w -r1.2.4.2.2.2 -r1.2.4.2.2.3
--- ContextManager.java 1 Jul 2003 02:27:11 -0000 1.2.4.2.2.2
+++ ContextManager.java 28 Oct 2003 20:20:26 -0000 1.2.4.2.2.3
@@ -15,7 +15,7 @@
private final static String makeID() {
String candidate = null;
do {
- candidate = Long.toHexString(Math.abs(Core.randSource.nextInt()));
+ candidate = Long.toHexString(Math.abs(Core.getRandSource().nextInt()));
}
while (table.get(candidate) != null);
Index: FproxyServlet.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/client/http/FproxyServlet.java,v
retrieving revision 1.43.2.25.2.9
retrieving revision 1.43.2.25.2.10
diff -u -w -r1.43.2.25.2.9 -r1.43.2.25.2.10
--- FproxyServlet.java 23 Jul 2003 01:56:51 -0000 1.43.2.25.2.9
+++ FproxyServlet.java 28 Oct 2003 20:20:26 -0000 1.43.2.25.2.10
@@ -131,7 +131,7 @@
if (bucketFactory == null) {
bucketFactory = bf;
if(bucketFactory != null) {
- if(logger != null && logger.shouldLog(Logger.DEBUG))
+ if(logger != null && logger.shouldLog(Logger.DEBUG,this))
logger.log(this, "Got BucketFactory from context",
Logger.DEBUG);
} else {
@@ -277,7 +277,7 @@
makeOnlyBucketFactory(tbf);
logger.log(this, "New FproxyServlet created", Logger.MINOR);
- if(logger.shouldLog(Logger.DEBUG)) {
+ if(logger.shouldLog(Logger.DEBUG,this)) {
logger.log(this, " requestHtl = " + requestHtl, Logger.DEBUGGING);
logger.log(this, " filter = " + runFilter, Logger.DEBUGGING);
logger.log(this, " filterParanoidStringCheck = " +
filterParanoidStringCheck,
@@ -303,7 +303,7 @@
// Stuff that needs to get finalized
Bucket data = null;
- boolean logDEBUG = logger.shouldLog(Logger.DEBUG);
+ boolean logDEBUG = logger.shouldLog(Logger.DEBUG,this);
try {
if(logDEBUG) logger.log(this, "Got GET request", Logger.DEBUGGING);
@@ -328,7 +328,8 @@
sUserAgent, Logger.DEBUGGING);
String sIPAddress = req.getRemoteAddr();
if(sIPAddress == null) return; // already closed!
- if (sUserAgent.indexOf("MSIE ") > 0) {
+ if (sUserAgent.indexOf("MSIE ") > 0 ||
+ sUserAgent.indexOf("Opera") > 0) {
if (!badBrowserWarningsSentTo.contains(sIPAddress)) {
try {
resp.setContentType("text/html");
@@ -337,7 +338,7 @@
PrintWriter pw = new PrintWriter(sw);
setNoCache(resp);
- pw.println("Freenet has determined that you are using
Internet Explorer. Please be aware that Internet Explorer treats contents in a manner
that makes it impossible for us to protect your anonymity while browsing Freenet using
this browser. We recommend that you use a browser that does not do this, for example,
Mozilla, K-Meleon, Phoenix, Lynx, Links, Amaya, or Arena.");
+ pw.println("Freenet has determined that you are using
Internet Explorer or Opera. Please be aware that Internet Explorer treats contents in
a manner that makes it impossible for us to protect your anonymity while browsing
Freenet using this browser. Opera also does this by default but can be configured not
to, and thus be safe to use with Freenet - please refer to the <a
href=\"/servlet/nodeinfo/documentation/readme\">README</a>. Some browsers that do not
do this are Mozilla, K-Meleon, Firebird (from Mozilla.org), Lynx, Links, Amaya, Arena,
or a correctly configured Opera.");
if (badBrowserWarningsSentTo.size() < maxBadBrowserIPs) {
pw.println("<p>If you are really really sure you want
to proceed, don't ");
pw.println("say we didn't warn you, and click <a
href=\"" + req.getRequestURI() +
@@ -662,13 +663,6 @@
if(logDEBUG)
logger.log(this, "fullMimeType now "+
fullMimeType, logger.DEBUG);
- } else {
- if(logDEBUG) logger.log(this, "mimeType length: "+
- mimeType.length()+", mimeType: "+
- mimeType+", starts with: "+
- mimeType.substring(0, "text/".length())+
- ", fullMimeType: "+fullMimeType,
- logger.DEBUG);
}
SplitFile splitFile = r.getMetadata().getSplitFile();
@@ -946,7 +940,7 @@
try {
key = URLEncoder.encode(key);
String encKey = HTMLEncoder.encode(key);
- boolean logDEBUG = logger.shouldLog(Logger.DEBUG);
+ boolean logDEBUG = logger.shouldLog(Logger.DEBUG,this);
if(logDEBUG) logger.log(this, "Key before encoding: "+key+
" , key after encoding: "+encKey, Logger.DEBUG);
PrintWriter pagew = null;
@@ -1237,7 +1231,7 @@
* @exception IOException Description of the Exception
*/
protected void sendRobots(HttpServletResponse resp) throws IOException {
- if(logger.shouldLog(Logger.DEBUG)) logger.log(this, "Sending robots.txt",
Logger.DEBUGGING);
+ if(logger.shouldLog(Logger.DEBUG,this)) logger.log(this, "Sending robots.txt",
Logger.DEBUGGING);
OutputStream out = resp.getOutputStream();
// if (!isLocalConnection) {
@@ -1278,7 +1272,7 @@
HttpServletResponseImpl.getNameForStatus(status);
// show it
- if(logger.shouldLog(Logger.DEBUG))
+ if(logger.shouldLog(Logger.DEBUG,this))
logger.log(this, "Sending HTTP error: " + statusString,
Logger.DEBUGGING);
PrintWriter pw = resp.getWriter();
@@ -1513,7 +1507,7 @@
"The request couldn't even make it off of your node. "+
"Try again, perhaps with <a href=\""+
"/[EMAIL PROTECTED],"+
- "XdCDmBuGsd-ulqbLnZ8v~w\">the GPL</a> to " +
+ "XdCDmBuGsd-ulqbLnZ8v~w/GPL.txt\">the GPL</a> to " +
"help your node learn about others. The publicly"+
" available seed nodes have been <b>very</b> busy "+
"lately. If possible try to get a friend to give "+
Index: HttpServletRunner.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/client/http/HttpServletRunner.java,v
retrieving revision 1.8.2.3.2.2
retrieving revision 1.8.2.3.2.3
diff -u -w -r1.8.2.3.2.2 -r1.8.2.3.2.3
--- HttpServletRunner.java 1 Jul 2003 02:27:12 -0000 1.8.2.3.2.2
+++ HttpServletRunner.java 28 Oct 2003 20:20:27 -0000 1.8.2.3.2.3
@@ -227,7 +227,7 @@
try {
if (!fname.equalsIgnoreCase("NO"))
log.addHook(new FileLoggerHook(fname, logFormat, logDate,
- thresh, false));
+ thresh, false, false));
else
log.addHook(new FileLoggerHook(System.err, logFormat,
logDate, thresh));
Index: InsertServlet_.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/client/http/InsertServlet_.java,v
retrieving revision 1.4.2.7.2.4
retrieving revision 1.4.2.7.2.5
diff -u -w -r1.4.2.7.2.4 -r1.4.2.7.2.5
--- InsertServlet_.java 23 Jul 2003 01:56:51 -0000 1.4.2.7.2.4
+++ InsertServlet_.java 28 Oct 2003 20:20:27 -0000 1.4.2.7.2.5
@@ -47,7 +47,7 @@
setupClientFactory(context);
defaultHtl = ParamParse.readInt(this, logger, "insertHtl", defaultHtl, 0, 100);
- defaultRetries = ParamParse.readInt(this, logger, "sfInsertRetries",
defaultRetries, 0, 10);
+ defaultRetries = ParamParse.readInt(this, logger, "sfInsertRetries",
defaultRetries, 0, 50);
defaultThreads = ParamParse.readInt(this, logger, "sfInsertThreads",
defaultThreads, 0, 100);
defaultRefreshIntervalSecs = ParamParse.readInt(this, logger,
"sfRefreshIntevalSecs",
defaultRefreshIntervalSecs,
-1, 3600);
@@ -308,14 +308,14 @@
pw.println("<td valign=\"top\">");
pw.println("<p><b>Key:</b> " + context.key);
pw.println("<br><b>Status:</b> ");
- pw.print("<img src=\"/servlet/images/aqua/" + ((progress != 0) ? "green"
: "blue") + "_start.png\" alt=\"\">");
+ pw.print("<img src=\"/servlet/images/aqua/" + ((progress != 0) ? "green"
: "blue") + "_start.png\" alt=\"\" width=\"5\" height=\"16\">");
if (progress != 0) {
pw.print("<img src=\"/servlet/images/aqua/green.png\" width=\"" +
(int) (progress * 300.0) + "\" height=\"16\" title=\"" + (int) (progress * 100.0)+
"%\" alt=\"" + (int) (progress * 100.0)+ "%\">");
}
if (progress != 1) {
pw.print("<img src=\"/servlet/images/aqua/blue.png\" width=\"" +
(int) ((1 - progress) * 300.0) + "\" height=\"16\" title=\"" + (int) (progress *
100.0) + "%\" alt=\"" + (int) (progress * 100.0) + "%\">");
}
- pw.print("<img src=\"/servlet/images/aqua/" + ((progress != 1) ? "blue" :
"green") + "_end.png\" alt=\"\">");
+ pw.print("<img src=\"/servlet/images/aqua/" + ((progress != 1) ? "blue" :
"green") + "_end.png\" alt=\"\" width=\"5\" height=\"16\">");
pw.print("<br><b>Request Started:</b> " +
context.dateFormat.format(context.startTime.getTime()));
pw.println(", <b>Time Elapsed:</b> " + timeDistance(context.startTime,
Calendar.getInstance()));
if ((progress >= 0.1) || ((context.status.blocksProcessed() > 4) &&
(context.status.insertedBytes() > 0))) {
@@ -749,7 +749,7 @@
////////////////////////////////////////////////////////////
private final MIME_binary[] extractParts(MIME_multipart formData) {
- MIME_binary[] parts = new MIME_binary[5];
+ MIME_binary[] parts = new MIME_binary[6];
for (int i = 0; i < formData.getPartCount(); i++) {
// REDFLAG: Remove.
@@ -778,6 +778,8 @@
parts[3] = (MIME_binary) formData.getPart(i);
} else if (name.equals("threads")) {
parts[4] = (MIME_binary) formData.getPart(i);
+ } else if (name.equals("retries")) {
+ parts[5] = (MIME_binary) formData.getPart(i);
} else {
freePart(formData.getPart(i));
}
@@ -903,6 +905,17 @@
return false;
}
}
+
+ // retries
+ if (parts[5] != null) {
+ try {
+ context.retries = Integer.parseInt(parts[5].getBodyAsString());
+ } catch (NumberFormatException nfe1) {
+ context.error = "Couldn't read an integer out of 'retries' field!";
+ freeParts(parts);
+ return false;
+ }
+ }
// Detect content-type if not specified.
if (context.mimeType == null || context.mimeType.equalsIgnoreCase("auto")) {
Index: NodeStatusServlet.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/client/http/NodeStatusServlet.java,v
retrieving revision 1.43.2.4.2.8
retrieving revision 1.43.2.4.2.9
diff -u -w -r1.43.2.4.2.8 -r1.43.2.4.2.9
--- NodeStatusServlet.java 2 Aug 2003 02:36:18 -0000 1.43.2.4.2.8
+++ NodeStatusServlet.java 28 Oct 2003 20:20:27 -0000 1.43.2.4.2.9
@@ -1,9 +1,11 @@
+/* -*- Mode: java; c-basic-indent: 4; indent-tabs-mode: nil -*- */
package freenet.client.http;
import java.io.*;
import java.net.*;
import java.util.*;
import java.text.DateFormat;
+import java.text.NumberFormat;
import javax.servlet.*;
import javax.servlet.http.*;
@@ -12,9 +14,15 @@
import freenet.ConnectionHandlerComparator;
import freenet.Core;
import freenet.Key;
+import freenet.DSAIdentity;
+import freenet.Identity;
+import freenet.node.Main;
import freenet.node.Node;
import freenet.node.NodeReference;
import freenet.node.rt.RTDiagSnapshot;
+import freenet.node.rt.NGRoutingTable;
+import freenet.node.rt.CPAlgoRoutingTable;
+import freenet.node.rt.TimeEstimator;
import freenet.node.LoadStats;
import freenet.diagnostics.Diagnostics;
import freenet.diagnostics.DiagnosticsFormat;
@@ -58,6 +66,32 @@
* @author giannij
**/
public class NodeStatusServlet extends HttpServlet {
+ private static final NumberFormat nfp;
+ private static final NumberFormat nf0;
+ private static final NumberFormat nf1;
+ private static final NumberFormat nf03;
+ private static final NumberFormat nf3;
+ static {
+ nfp = NumberFormat.getPercentInstance();
+ nfp.setMinimumFractionDigits(0);
+ nfp.setMaximumFractionDigits(1);
+ nf0 = NumberFormat.getInstance();
+ nf0.setMinimumFractionDigits(0);
+ nf0.setMaximumFractionDigits(0);
+ nf0.setGroupingUsed(false);
+ nf1 = NumberFormat.getInstance();
+ nf1.setMaximumFractionDigits(1);
+ nf1.setMinimumFractionDigits(1);
+ nf1.setGroupingUsed(false);
+ nf03 = NumberFormat.getInstance();
+ nf03.setMinimumFractionDigits(0);
+ nf03.setMaximumFractionDigits(3);
+ nf03.setGroupingUsed(false);
+ nf3 = NumberFormat.getInstance();
+ nf3.setMaximumFractionDigits(3);
+ nf3.setMinimumFractionDigits(3);
+ nf3.setGroupingUsed(false);
+ }
public void init() {
ServletContext context = getServletContext();
node = (Node)context.getAttribute("freenet.node.Node");
@@ -175,7 +209,7 @@
if (uri.endsWith("ds_size_histogram.txt")) {
sendDSSizeHistogram(resp, false);
return;
- };
+ }
if (uri.endsWith("inbound_request_histogram.txt")) {
int[] bins = null;
@@ -423,17 +457,50 @@
sendPSuccessList(resp, true, true);
return;
}
-
+ String chunk = "";
if (uri.endsWith("noderefs.txt")) {
sendRefList(req, resp);
- }
- else if (uri.endsWith("nodestatus.html")) {
+ } else if (uri.endsWith("nodestatus.html")) {
sendStatusPage(resp);
- }
- else if (uri.endsWith("tickerContents.html")) {
+ } else if (uri.endsWith("tickerContents.html")) {
sendTickerContents(resp);
+ } else if(uri.endsWith("nodeDetails.html")) {
+ String id = req.getParameter("identity");
+ if(id != null) {
+ DSAIdentity i = null;
+ try {
+ i = new DSAIdentity(freenet.crypt.Global.DSAgroupC,
+ id);
+ } catch (Throwable t) {
+ Core.logger.log(this, "Caught "+t+" creating Identity from
"+id, Logger.NORMAL);
+ sendIndexPage(resp, baseURL);
+ }
+ // FIXME: if nodes generate their own groups, this will need to
be revised... group would be humongous, so maybe we could use fingerprint
+ if(i != null)
+ sendNodePage(i, req, resp);
+ } else {
+ sendIndexPage(resp, baseURL);
+ }
+ } else if(uri.endsWith("nodeGraph.bmp")) {
+ String id = req.getParameter("identity");
+ if(id != null) {
+ DSAIdentity i = null;
+ try {
+ i = new DSAIdentity(freenet.crypt.Global.DSAgroupC,
+ id);
+ } catch (Throwable t) {
+ Core.logger.log(this, "Caught "+t+" creating Identity from
"+id, Logger.NORMAL);
+ sendIndexPage(resp, baseURL);
}
- else if (uri.endsWith("ocmContents.html")) {
+ // FIXME: if nodes generate their own groups, this will need to
be revised... group would be humongous, so maybe we could use fingerprint
+ if(i != null)
+ sendNodeGraph(i, req, resp);
+ } else {
+ sendIndexPage(resp, baseURL);
+ }
+ } else if(uri.endsWith("global.bmp")) {
+ sendGlobalGraph(req, resp);
+ } else if (uri.endsWith("ocmContents.html")) {
sendOcmContents(resp,req);
} else if (uri.endsWith("diagnostics/index.html")) {
sendDiagnosticsIndex(resp);
@@ -474,8 +541,10 @@
// It's not just thread based. There's also a hard
// rate limit.
- boolean rejectingRequests = node.rejectingRequests();
- boolean rejectingConnections = node.rejectingConnections();
+ StringBuffer whyRejectingRequests = new StringBuffer(500);
+ boolean rejectingRequests = node.rejectingRequests(whyRejectingRequests);
+ StringBuffer whyRejectingConnections = new StringBuffer(500);
+ boolean rejectingConnections =
node.rejectingConnections(whyRejectingConnections);
if (jobs > -1) {
String color = "black";
@@ -492,16 +561,16 @@
String msg = Integer.toString(jobs);
int maxthreads = node.getThreadFactory().maximumThreads();
+ int available = node.availableThreads();
if (maxthreads > 0) {
- float threadPoolLoad = (((float)jobs) / maxthreads) * 100.0f;
- msg += " (" +
- Float.toString(threadPoolLoad) + "%) ";
+ msg += " (" + nfp.format((float)jobs / maxthreads) + ")
";
}
msg += " <font color=\"" + color + "\"> " +
comment + " </font> <br>";
- pw.println("<li> Active pooled jobs: " + msg);
+ pw.println("<li> Pooled threads running jobs: " + msg);
+ pw.println("<li> Pooled threads which are idle: " + available + "<br>");
if (rejectingConnections || rejectingRequests) {
pw.println("It's normal for the node to sometimes reject connections
or requests");
@@ -510,8 +579,9 @@
}
}
- float f = node.estimatedLoad();
- pw.println("<li> Current estimated load: " + f*100 + "%. <br> ");
+ StringBuffer why = new StringBuffer(500);
+ float f = node.estimatedLoad(why);
+ pw.println("<li> Current estimated load: " + nfp.format(f) + ". <br>" +
why.toString());
pw.println("<p>");
}
@@ -578,13 +648,13 @@
pw.println(" <li> <a href=\"" + baseURL +"nodestatus.html\"> Node
Reference Status </a><p>");
pw.println(" <li> Histograms ");
pw.println(" <ul>");
-
+ if(Main.origRT instanceof CPAlgoRoutingTable) {
pw.println(" <li> <a href=\"" + baseURL + "key_histogram.txt\">" +
" Histogram of the keys in the node's routing table. </a>" +
"<a href=\"" + baseURL +
"key_histogram_detail.txt\">(detail)</a><br>");
pw.println(" <a href= \"" + baseURL +
"key_histogram_data.txt\">(flat ascii)</a>" +
"<a href=\"" + baseURL +
"key_histogram_data_detail.txt\">(detail)</a><br>");
-
+ }
pw.println(" <li> <a href=\"" + baseURL +
"inbound_request_histogram.txt\">" +
" Histogram of inbound request search keys. </a>" +
"<a href=\"" + baseURL +
"inbound_request_histogram_detail.txt\">(detail)</a><br>");
@@ -862,7 +932,8 @@
resp.setStatus(HttpServletResponse.SC_OK);
resp.setContentType("text/plain");
PrintWriter pw = resp.getWriter();
- pw.println("Probability of success of an incoming request");
+ pw.println("Probability of success of an incoming "+
+ (inserts?"insert":"request"));
if(inserts) {
boolean b = false;
if(node.successInsertDistribution == null) {
@@ -960,7 +1031,8 @@
pw.println(comment);
pw.println(date);
pw.println(commodity + ": " + count);
- pw.println("scale factor: " + scale + " (This is used to keep lines < 64
characters)");
+ pw.println("scale factor: " + scale +
+ " (This is used to keep lines < 64 characters)");
pw.println("");
}
for (i = 0; i < bins.length; i++) {
@@ -1007,6 +1079,95 @@
return ret;
};
+ private void sendNodePage(Identity i, HttpServletRequest req,
+ HttpServletResponse resp) throws IOException {
+ RoutingTable rt = Main.origRT;
+ if(rt instanceof NGRoutingTable) {
+ NGRoutingTable ngrt = (NGRoutingTable)rt;
+ PrintWriter pw = resp.getWriter();
+ resp.setContentType("text/html");
+ ngrt.toHtml(i, pw, "nodeGraph.bmp?identity="+
+ ((DSAIdentity)i).getYAsHexString()+"&estimator=");
+ } else {
+ resp.sendError(404, "Not an NGRoutingTable");
+ }
+ }
+
+ private void sendNodeGraph(Identity i, HttpServletRequest req,
+ HttpServletResponse resp) throws IOException {
+ RoutingTable rt = Main.origRT;
+ if(rt instanceof NGRoutingTable) {
+ NGRoutingTable ngrt = (NGRoutingTable)rt;
+ String graph = req.getParameter("estimator");
+ if(graph == null)
+ resp.sendError(404, "No graph name specified");
+ TimeEstimator e = ngrt.getEstimator(i, graph);
+ int width = 640;
+ String pwidth = req.getParameter("width");
+ if(pwidth != null) {
+ try {
+ width = Integer.parseInt(pwidth);
+ } catch (NumberFormatException ex) {
+ width = 640;
+ }
+ }
+ int height = 480;
+ String pheight = req.getParameter("height");
+ if(pheight != null) {
+ try {
+ height = Integer.parseInt(pheight);
+ } catch (NumberFormatException ex) {
+ height = 480;
+ }
+ }
+ String clip = req.getParameter("clippoints");
+ boolean clippoints = false;
+ if(clip != null &&
+ (clip.equalsIgnoreCase("true") || clip.equalsIgnoreCase("yes")))
+ clippoints = true;
+ resp.setContentType("image/bmp");
+ e.drawGraphBMP(width, height, !clippoints, resp.getOutputStream());
+ } else {
+ resp.sendError(404, "Not an NGRoutingTable");
+ }
+ }
+
+ private void sendGlobalGraph(HttpServletRequest req,
+ HttpServletResponse resp) throws IOException {
+ RoutingTable rt = Main.origRT;
+ if(rt instanceof NGRoutingTable) {
+ NGRoutingTable ngrt = (NGRoutingTable)rt;
+ TimeEstimator e = ngrt.getGlobalEstimator();
+ int width = 640;
+ String pwidth = req.getParameter("width");
+ if(pwidth != null) {
+ try {
+ width = Integer.parseInt(pwidth);
+ } catch (NumberFormatException ex) {
+ width = 640;
+ }
+ }
+ int height = 200;
+ String pheight = req.getParameter("height");
+ if(pheight != null) {
+ try {
+ height = Integer.parseInt(pheight);
+ } catch (NumberFormatException ex) {
+ height = 480;
+ }
+ }
+ String clip = req.getParameter("clippoints");
+ boolean clippoints = false;
+ if(clip != null &&
+ (clip.equalsIgnoreCase("true") || clip.equalsIgnoreCase("yes")))
+ clippoints = true;
+ resp.setContentType("image/bmp");
+ e.drawGraphBMP(width, height, !clippoints, resp.getOutputStream());
+ } else {
+ resp.sendError(404, "Not an NGRoutingTable");
+ }
+ }
+
private void sendStatusPage(HttpServletResponse resp) throws IOException {
long now = System.currentTimeMillis();
DateFormat df = DateFormat.getDateTimeInstance();
@@ -1041,7 +1202,10 @@
makeRefDownloadForm(refData, pw);
+ if(typeName.equals("freenet.node.rt.CPAlgoRoutingTable"))
pw.println("<p><div align=\"center\"><img
src=\"/servlet/nodeinfo/internal/rthist/rthist.bmp?length=800&height=50\"></div></p>");
+ else
+ pw.println("<p><div align=\"center\"><img src=\"global.bmp\"></div></p>");
pw.println("<p>");
@@ -1049,6 +1213,7 @@
makeTableHeader(status, pw);
+ if(refData != null)
makeRefRowEntries(refData, typeName, pw);
pw.println("</table>");
@@ -1235,7 +1400,7 @@
resp.setStatus(HttpServletResponse.SC_OK);
resp.setContentType("text/plain");
- boolean logDEBUG = Core.logger.shouldLog(Logger.DEBUG);
+ boolean logDEBUG = Core.logger.shouldLog(Logger.DEBUG,this);
final StringMap[] refs = rt.getSnapshot().refData();
if ((refs == null) || (refs.length < 1)) {
resp.getWriter().println(""); // so that document is not empty.
@@ -1310,7 +1475,7 @@
HttpServletResponseImpl.getNameForStatus(status);
// show it
- if(Core.logger.shouldLog(Logger.DEBUG))
+ if(Core.logger.shouldLog(Logger.DEBUG,this))
Core.logger.log(this, "Sending HTTP error: " + statusString,
Logger.DEBUGGING);
PrintWriter pw = resp.getWriter();
@@ -1659,7 +1824,38 @@
return refValues;
}
- if (rtType.equals("freenet.node.rt.CPAlgoRoutingTable")) {
+ boolean failing = true;
+ boolean isCPRT = rtType.equals("freenet.node.rt.CPAlgoRoutingTable");
+ boolean isNGRT = rtType.equals("freenet.node.rt.NGRoutingTable");
+ int ngrtadd = isNGRT?1:0;
+ NodeReference ref = null;
+ if (isCPRT || isNGRT) {
+ if (refValues[2+ngrtadd].equals(ZERO)) {
+ refValues[2+ngrtadd] = "none";
+ failing = false;
+ }
+ int col = isCPRT ? 12 : 15;
+ refValues[col] = refValues[col].toString() + "/" +
+ refValues[col+1];
+ if(refValues[col].equals("0/0")) {
+ refValues[col] = "<font color=\"red\">0/0</font>";
+ } else {
+ refValues[col] = "<font color=\"green\">"+refValues[col]+
+ "</font>";
+ }
+ long lastTry = ((Long)refValues[5+ngrtadd]).longValue();
+ if (lastTry <= 0 || lastTry >= (1000*1000*1000)) {
+ if(lastTry > 0)
+ Core.logger.log(this, "lastTry has ridiculous value "+
+ lastTry+" in formatRef",
+ new Exception("debug"), Logger.NORMAL);
+ refValues[5+ngrtadd] = "never";
+ } else {
+ refValues[5+ngrtadd] = refValues[5+ngrtadd].toString() + " secs. ago";
+ }
+ }
+ if (isCPRT) {
+ ref = (NodeReference)refValues[6];
long attempts = ((Long)refValues[3]).longValue();
long successful = ((Long)refValues[4]).longValue();
if (attempts > 0 && successful > 0) {
@@ -1668,15 +1864,7 @@
+ (long) (100 * successful / (double)attempts) + "%)";
}
- boolean failing = true;
- if (refValues[2].equals(ZERO)) {
- refValues[2] = "none";
- failing = false;
- }
-
long ver = ((Long)refValues[9]).longValue();
- NodeReference ref = (NodeReference)refValues[6];
-
String s = " <font color=\"";
String v = "";
@@ -1710,17 +1898,6 @@
if(!v.equals(""))
refValues[1] = s + v + "\"> " + refValues[1] + "</font> ";
- long lastTry = ((Long)refValues[5]).longValue();
- if (lastTry <= 0 || lastTry >= (1000*1000*1000)) {
- if(lastTry > 0)
- Core.logger.log(this, "lastTry has ridiculous value "+
- lastTry+" in formatRef",
- new Exception("debug"), Logger.NORMAL);
- refValues[5] = "never";
- } else {
- refValues[5] = refValues[5].toString() + " secs. ago";
- }
-
// clean up version
String verString = (String)refValues[7];
int pos = verString.lastIndexOf(",");
@@ -1731,12 +1908,14 @@
if(refValues[11] != null && ver != 0) {
refValues[9] = "<a href=\"/"+refValues[11]+"\">" + refValues[9] +
"</a>";
}
- }
- refValues[12] = refValues[12].toString() + "/" + refValues[13];
- if(refValues[12].equals("0/0")) {
- refValues[12] = "<font color=\"red\">0/0</font>";
- } else {
- refValues[12] = "<font color=\"green\">"+refValues[12]+"</font>";
+ } else if(isNGRT) {
+ ref = (NodeReference)refValues[10];
+ refValues[1] = refValues[1].toString() + "ms";
+ refValues[8] = refValues[8].toString() + "ms";
+ refValues[9] = refValues[9].toString() + "ms";
+ refValues[0] = "<a href=\"nodeDetails.html?identity="+
+ ((DSAIdentity)(ref.getIdentity())).getYAsHexString()+
+ "\">"+refValues[0]+"</a>";
}
// WTF?
Index: SFRContext.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/client/http/SFRContext.java,v
retrieving revision 1.2.4.16
retrieving revision 1.2.4.17
diff -u -w -r1.2.4.16 -r1.2.4.17
--- SFRContext.java 23 Jul 2003 01:56:51 -0000 1.2.4.16
+++ SFRContext.java 28 Oct 2003 20:20:27 -0000 1.2.4.17
@@ -211,7 +211,7 @@
return "You must specify the name of a folder writable by "+
"the node, or which the node can create";
else {
- if(logger.shouldLog(Logger.DEBUG))
+ if(logger.shouldLog(Logger.DEBUG,this))
logger.log(this, "WriteToDisk set to true for "+this,
Logger.DEBUG);
writeToDisk = true;
@@ -247,7 +247,7 @@
// DO NOT call this on the downloading thread.
// Cancels and releases all resources as soon as possible.
synchronized void cancel() {
- boolean logDEBUG = Core.logger.shouldLog(Logger.DEBUG);
+ boolean logDEBUG = Core.logger.shouldLog(Logger.DEBUG,this);
if(logDEBUG) logger.log(this, "In cancel(), state "+stateAsString(),
Logger.DEBUG);
if (canceling) {
@@ -397,7 +397,7 @@
else {
// No decoder at all.
decoderErrMsg = "No FEC decoder specified in
SplitFile metadata!";
- if(logger.shouldLog(Logger.DEBUG))
+ if(logger.shouldLog(Logger.DEBUG,this))
logger.log(this, "No FEC decoder specified for
"+uri,
new Exception("debug"), logger.DEBUG);
}
@@ -488,7 +488,7 @@
RequestThread t = null;
void doBackgroundRequest() {
- if(logger.shouldLog(Logger.DEBUG))
+ if(logger.shouldLog(Logger.DEBUG,this))
logger.log(this, "doBackgroundRequest for "+this, Logger.DEBUG);
if(t == null) {
t = new RequestThread();
@@ -498,7 +498,7 @@
class RequestThread extends Thread {
public void run() {
- if(logger.shouldLog(Logger.DEBUG))
+ if(logger.shouldLog(Logger.DEBUG,this))
logger.log(this, "Starting RequestThread", Logger.DEBUG);
try {
doRequest(null, null);
Index: SplitFileRequestServlet.java
===================================================================
RCS file:
/cvsroot/freenet/freenet/src/freenet/client/http/SplitFileRequestServlet.java,v
retrieving revision 1.18.2.14.2.12
retrieving revision 1.18.2.14.2.13
diff -u -w -r1.18.2.14.2.12 -r1.18.2.14.2.13
--- SplitFileRequestServlet.java 23 Jul 2003 01:56:51 -0000 1.18.2.14.2.12
+++ SplitFileRequestServlet.java 28 Oct 2003 20:20:28 -0000 1.18.2.14.2.13
@@ -130,7 +130,7 @@
else
filterPassThroughMimeTypes = Node.filterPassThroughMimeTypes;
logger.log(this, "New SplitFileRequestServlet created", Logger.MINOR);
- if(logger.shouldLog(Logger.DEBUG)) {
+ if(logger.shouldLog(Logger.DEBUG,this)) {
logger.log(this, " requestHtl = " + defaultHtl, Logger.DEBUGGING);
logger.log(this, " sfBlockHtl = " + defaultBlockHtl, Logger.DEBUGGING);
logger.log(this, " sfRequestRetries = " + defaultRetries,
@@ -305,7 +305,7 @@
// Parse out url
String key = null;
String path = null;
- boolean logDEBUG = logger.shouldLog(Logger.DEBUG);
+ boolean logDEBUG = logger.shouldLog(Logger.DEBUG,this);
try {
if(logDEBUG) logger.log(this, "Got request: "+key, Logger.DEBUG);
// getRequestURI() does not include params, so can be decoded
@@ -373,7 +373,7 @@
protected void onDownload(HttpServletRequest req, HttpServletResponse resp,
SFRContext context)
throws ServletException, IOException {
- boolean logDEBUG = logger.shouldLog(Logger.DEBUG);
+ boolean logDEBUG = logger.shouldLog(Logger.DEBUG,this);
if(logDEBUG) logger.log(this, "onDownload(,,"+context+") on "+this,
Logger.DEBUG);
try {
@@ -391,7 +391,7 @@
protected void onCancel(HttpServletRequest req, HttpServletResponse resp,
SFRContext context)
throws ServletException, IOException {
- boolean logDEBUG = logger.shouldLog(Logger.DEBUG);
+ boolean logDEBUG = logger.shouldLog(Logger.DEBUG,this);
if(logDEBUG) logger.log(this, "Called onCancel()", Logger.DEBUG);
context.cancel();
if(logDEBUG) logger.log(this, "Out of context.cancel()", Logger.DEBUG);
@@ -475,14 +475,14 @@
double progress = (double) context.status.retrievedBytes() / (double)
totalSize;
tpw.println("<br><b>Status</b>: ");
- tpw.print("<img src=\"/servlet/images/aqua/" + ((progress != 0) ? "green"
: "blue") + "_start.png\" alt=\"\">");
+ tpw.print("<img src=\"/servlet/images/aqua/" + ((progress != 0) ? "green"
: "blue") + "_start.png\" alt=\"\" width=\"5\" height=\"16\">");
if (progress != 0) {
tpw.print("<img src=\"/servlet/images/aqua/green.png\" width=\"" +
(int) (progress * 300.0) + "\" height=\"16\" title=\"" + (int) (progress * 100.0)+
"%\" alt=\"" + (int) (progress * 100.0)+ "%\">");
}
if (progress != 1) {
tpw.print("<img src=\"/servlet/images/aqua/blue.png\" width=\"" +
(int) ((1 - progress) * 300.0) + "\" height=\"16\" title=\"" + (int) (progress *
100.0) + "%\" alt=\"" + (int) (progress * 100.0) + "%\">");
}
- tpw.print("<img src=\"/servlet/images/aqua/" + ((progress != 1) ? "blue"
: "green") + "_end.png\" alt=\"\">");
+ tpw.print("<img src=\"/servlet/images/aqua/" + ((progress != 1) ? "blue"
: "green") + "_end.png\" alt=\"\" width=\"5\" height=\"16\">");
//long deltat = (System.currentTimeMillis() - context.status.touched()) /
1000;
//if (deltat < 60) {
// tpw.print(" <b>Idle</b>: " + deltat + " seconds");
@@ -641,7 +641,7 @@
SFRContext context)
throws ServletException, IOException {
- boolean logDEBUG = logger.shouldLog(Logger.DEBUG);
+ boolean logDEBUG = logger.shouldLog(Logger.DEBUG,this);
// if the download has already started, skip the bottom
// frame and redirect to the status_progress page.
if (context.state != STATE_STARTING) {
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs