Update of /cvsroot/freenet/freenet/src/freenet/client/http
In directory sc8-pr-cvs1:/tmp/cvs-serv32518/src/freenet/client/http
Modified Files:
FproxyServlet.java NodeStatusServlet.java
Log Message:
6163: Merge NGRouting
* Routing table switch: new config option routingTableImpl - "classic" or "ng"
* New diagnostics variables: normalizedSuccessTime, successSearchTime,
successTransferRate, requestSuccessRatio, requestFailureRoutingOrNotRatio,
routingSuccessRatio. These are reported by both RT modes, so should be usable for
comparative purposes.
* Significant changes to Node Status Servlet, including a page with several graphs for
each node in the RT.
* Significant changes to ConnectionOpener. Fixes to races that were causing
RouteNotFound errors, a toString(), much more and better logging.
* Make a distinction between failed caching a DataReply due to IOE in the store and
due to IOE on the stream when caching a DataReply. Use this in the code to make sure
we respond correctly w.r.t. routing (it's more important in NGRouting).
* RoutingTable.route() now takes extra params: HTL, size, whether it is an insert.
Added reportConnectionSuccess, reportConnectionFailure, used by ConnectionOpener to
tell RT about connections.
* Major changes to the existing ResponseTimeEstimator class. Changed logic, changed
serialization, changed interface, just about everything. Now implements the generic
TimeEstimator, knows about time versus transfer rate versus probability, wraps around
properly, has some significant algorithm changes.
* Change Routing interface significantly. Several new me methods, old ones have been
given new arguments. Caller must for stats eventually call terminate(), or another
terminal method (transferSuccess, dataNotFound). New base class, TerminatableRouting
(implements Routing, base of NGRouting and TreeRouting), handles most of the stats.
* Add code all over states/ (mostly request, but also the others) for notifying the
Routing of timings and status, terminating the Routing, some reporting bugfixes, get
rid of the old "NGROUTING" debug log diagnostics.
* Lots of completely new code for NGRouting, mostly in freenet/node/rt/
Misc fixes etc
* Fix a deadlock in ConnectionHandler
* Iakin fix for 1.4.2 and later changed static initialization behaviour w.r.t.
Core.params.
* Added messageSuccessRatio, tracks proportion of messages successfully sent
* Fix some NullPointerExceptions
* Spelling fixes to descriptions of diagnostic variables by Edward J. Huff
* Fixes to AbstractSelectorLoop.queueClose*, connection close notifications were being
missed.
* Catch all throwables thrown by process() processing maintenance queue
Minor/future
* Notes on inserts (attacks, NGRouting)
* Give the ref to the GPL on the RNF page a filename
* Even more logging improvements
* More minor reindenting/restyling
Index: FproxyServlet.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/client/http/FproxyServlet.java,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- FproxyServlet.java 22 Jul 2003 03:17:29 -0000 1.104
+++ FproxyServlet.java 30 Aug 2003 23:16:51 -0000 1.105
@@ -1513,7 +1513,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: NodeStatusServlet.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/client/http/NodeStatusServlet.java,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- NodeStatusServlet.java 30 Jul 2003 18:34:02 -0000 1.67
+++ NodeStatusServlet.java 30 Aug 2003 23:16:51 -0000 1.68
@@ -12,9 +12,14 @@
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.TimeEstimator;
import freenet.node.LoadStats;
import freenet.diagnostics.Diagnostics;
import freenet.diagnostics.DiagnosticsFormat;
@@ -423,17 +428,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("ocmContents.html")) {
+ } 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);
+ }
+ // 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);
@@ -1007,6 +1045,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 = true;
+ if(clip != null &&
+ (clip.equalsIgnoreCase("false") || clip.equalsIgnoreCase("no")))
+ clippoints = false;
+ 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 = true;
+ if(clip != null &&
+ (clip.equalsIgnoreCase("false") || clip.equalsIgnoreCase("no")))
+ clippoints = false;
+ 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();
@@ -1040,16 +1167,20 @@
makePerTableData(status, tableData, pw);
makeRefDownloadForm(refData, pw);
-
- pw.println("<p><div align=\"center\"><img
src=\"/servlet/nodeinfo/internal/rthist/rthist.bmp?length=800&height=50\"></div></p>");
+
+ 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>");
pw.println("<table border>");
makeTableHeader(status, pw);
-
- makeRefRowEntries(refData, typeName, pw);
+
+ if(refData != null)
+ makeRefRowEntries(refData, typeName, pw);
pw.println("</table>");
@@ -1659,7 +1790,37 @@
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");
+ NodeReference ref = null;
+ if (isCPRT || isNGRT) {
+ if (refValues[2].equals(ZERO)) {
+ refValues[2] = "none";
+ failing = false;
+ }
+ int col = isCPRT ? 12 : 14;
+ 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]).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";
+ }
+ }
+ 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 +1829,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 +1863,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 +1873,13 @@
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[9];
+ refValues[7] = refValues[7].toString() + "ms";
+ refValues[8] = refValues[8].toString() + "ms";
+ refValues[0] = "<a href=\"nodeDetails.html?identity="+
+ ((DSAIdentity)(ref.getIdentity())).getYAsHexString()+
+ "\">"+refValues[0]+"</a>";
}
// WTF?
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs