This isn't quite what we were talking about, is it? I thought the topic
under discussion was how often we could send handshake packets?
I am happy to reduce the frequency of fetching ARKs, and even to allow
it to be configured. Variables should start with a lower case character,
and constants should be BLOCK_CAPITALS, and if max is configurable and
in Node, then min should probably be likewise - at least as a constant.
On Fri, Jun 02, 2006 at 12:02:34PM -0400, Colin Davis wrote:
>
> diff -r -u freenet/src/freenet/node/ARKFetcher.java modified/src/
> freenet/node/ARKFetcher.java
> --- freenet/src/freenet/node/ARKFetcher.java 2006-06-02
> 11:29:14.000000000 -0400
> +++ modified/src/freenet/node/ARKFetcher.java 2006-06-02
> 11:34:45.000000000 -0400
> @@ -15,6 +15,11 @@
> import freenet.support.Logger;
> import freenet.support.SimpleFieldSet;
>
> +import freenet.config.Config;
> +import freenet.config.LongCallback;
> +import freenet.config.SubConfig;
> +
> +
> /**
> * Fetch an ARK. Permanent, tied to a PeerNode, stops itself after
> a successful fetch.
> */
> @@ -25,18 +30,18 @@
> private ClientGetter getter;
> private FreenetURI fetchingURI;
> private boolean shouldRun = false;
> - private static final int MAX_BACKOFF = 60*60*1000;
> private static final int MIN_BACKOFF = 5*1000;
> private int backoff = MIN_BACKOFF;
> private String identity;
> private boolean isFetching = false;
> -
> +
> public ARKFetcher(PeerNode peer, Node node) {
> this.peer = peer;
> this.node = node;
> this.identity = peer.getIdentityString();
> }
>
> +
> /**
> * Called when the node starts / is added, and also when we fail
> to connect twice
> * after a new reference. (So we get one from the ARK, we wait for
> the current
> @@ -141,7 +146,7 @@
> return;
> }
> backoff += backoff;
> - if(backoff > MAX_BACKOFF) backoff = MAX_BACKOFF;
> + if(backoff > node.Max_Arkbackoff) backoff =
> node.Max_Arkbackoff;
> Logger.minor(this, "Failed to fetch ARK for "+peer+", now
> backing off ARK fetches for "+(int) (backoff / 1000)+"
> seconds");
> // We may be on the PacketSender thread.
> // FIXME should this be exponential backoff?
> diff -r -u freenet/src/freenet/node/Node.java modified/src/freenet/
> node/Node.java
> --- freenet/src/freenet/node/Node.java 2006-06-02 11:29:14.000000000
> -0400
> +++ modified/src/freenet/node/Node.java 2006-06-02
> 11:27:07.000000000 -0400
> @@ -601,6 +601,8 @@
>
> private static NodeStarter nodeStarter;
>
> + public int Max_Arkbackoff;
> +
> /**
> * Read all storable settings (identity etc) from the node file.
> * @param filename The name of the file to read from.
> @@ -921,7 +923,7 @@
> bootID = random.nextLong();
> throttledPacketSendAverage =
> new TimeDecayingRunningAverage(1, 10*60*1000 /* should be
> significantly longer than a typical transfer */, 0, Long.MAX_VALUE);
> -
> + Max_Arkbackoff=60*60*1000;
> // Setup node-specific configuration
>
> SubConfig nodeConfig = new SubConfig("node", config);
> @@ -1126,7 +1128,17 @@
>
>
> }
> -
> +
> + nodeConfig.register("MaximumArkdelay", 60*60*1000 /* 1 per
> minute */,2, true, "Maximum delay between ARK requests", "Maximum delay
> (in seconds) between ARK requests- Do not touch this unless you are
> *SURE* you are not behind a NAT.",
> + new IntCallback() {
> + public int get() {
> + return Max_Arkbackoff;
> + }
> + public void set(int val) {
> + if(val == Max_Arkbackoff)
> return;
> + val = Max_Arkbackoff;
> + }
> + });
> // Directory for node-related files other than store
>
> nodeConfig.register("nodeDir", ".", 6, true, "Node
> directory", "Name of directory to put node-related files e.g. peers
> list in",
--
Matthew J Toseland - toad at amphibian.dyndns.org
Freenet Project Official Codemonkey - http://freenetproject.org/
ICTHUS - Nothing is impossible. Our Boss says so.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL:
<https://emu.freenetproject.org/pipermail/devl/attachments/20060602/54a2de71/attachment.pgp>