On Saturday 14 October 2006 12:57, nextgens at freenetproject.org wrote:
> Author: nextgens
> Date: 2006-10-14 11:57:08 +0000 (Sat, 14 Oct 2006)
> New Revision: 10661
>
> Modified:
> trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
> Log:
> Small hack on fproxy to deny node removal if there isn't one week of
inactivity.
Is there a particular reason for this? Surely if a user is removing an active
node, they're doing it for a reason. This strikes me as very patronising.
> Maybe it should be done in Node.removeDarknetConnection insteed.
>
> Modified:
trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
> ===================================================================
> --- trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
2006-10-11 11:25:22 UTC (rev 10660)
> +++ trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
2006-10-14 11:57:08 UTC (rev 10661)
> @@ -602,7 +602,6 @@
> HTMLNode node = new HTMLNode("div");
> node.addChild("#", "Unable to verify the
> signature of the given
reference ("+e1+").");
> node.addChild("br");
> - HTMLNode pre = node.addChild("pre",
> fs.toOrderedString());
> this.sendErrorPage(ctx, 200, "Failed To Add
> Node", node);
> return;
> }
> @@ -762,16 +761,20 @@
> headers.put("Location", "/darknet/");
> ctx.sendReplyHeaders(302, "Found", headers, null, 0);
> return;
> - } else if (request.isPartSet("remove") ||
> (request.isPartSet("submit") &&
request.getPartAsString("action",25).equals("remove"))) {
> - //int hashcode =
> Integer.decode(request.getParam("node")).intValue();
> -
> + } else if (request.isPartSet("remove") ||
> (request.isPartSet("submit") &&
request.getPartAsString("action",25).equals("remove"))) {
> if(logMINOR) Logger.minor(this, "Remove node");
>
> PeerNode[] peerNodes = node.getDarknetConnections();
> for(int i = 0; i < peerNodes.length; i++) {
> - if
> (request.isPartSet("node_"+peerNodes[i].hashCode())) {
> -
> this.node.removeDarknetConnection(peerNodes[i]);
> - if(logMINOR) Logger.minor(this,
> "Removed node:
node_"+peerNodes[i].hashCode());
> + if
> (request.isPartSet("node_"+peerNodes[i].hashCode())) {
> +
> if((peerNodes[i].timeLastConnectionCompleted() <
(System.currentTimeMillis() - 1000*60*60*24*7) /* one week */) ||
(peerNodes[i].peerNodeStatus == Node.PEER_NODE_STATUS_NEVER_CONNECTED)){
> +
> this.node.removeDarknetConnection(peerNodes[i]);
> + if(logMINOR) Logger.minor(this,
> "Removed node:
node_"+peerNodes[i].hashCode());
> + }else{
> + if(logMINOR) Logger.minor(this,
> "Refusing to remove :
node_"+peerNodes[i].hashCode()+" (trying to prevent network churn)");
> + this.sendErrorPage(ctx, 401,
> "Error while removing the node", "Sorry,
you can't remove nodes until they have reached one week of inactivity.");
> + return; // FIXME: maybe it
> breaks multi-node removing
> + }
> } else {
> if(logMINOR) Logger.minor(this, "Part
> not set:
node_"+peerNodes[i].hashCode());
> }
>
> _______________________________________________
> cvs mailing list
> cvs at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
>