Some issues..
On Thursday 06 December 2007 20:24, you wrote:
> Author: robert
> Date: 2007-12-06 20:24:08 +0000 (Thu, 06 Dec 2007)
> New Revision: 16372
>
> Modified:
> trunk/freenet/src/freenet/node/MessageItem.java
> trunk/freenet/src/freenet/node/RequestHandler.java
> Log:
> Don't hang onto a RequestHandler thread just to track the bytes.
>
> @@ -144,11 +148,14 @@
> new BlockTransmitter(node.usm, source, uid, prb,
node.outputThrottle, this);
> node.addTransferringRequestHandler(uid);
> if(bt.send(node.executor)) {
> - status = RequestSender.SUCCESS; // for byte logging
> + // for byte logging
> + status = RequestSender.SUCCESS;
> // We've fetched it from our datastore, so there won't
> be a
downstream noderef.
> // But we want to send at least an
> FNPOpennetCompletedAck,
otherwise the request source
> // may have to timeout waiting for one.
> finishOpennetNoRelay();
> + //also for byte logging, since the block is
the 'terminal' message.
> + applyByteCounts();
Careful here! IMHO we need to include the opennet messages in the bytes total
for the request. finishOpennetNoReply() may sendAsync a
FNPOpennetCompletedAck or an actual noderef...
> @@ -172,13 +179,14 @@
> if((waitStatus & RequestSender.WAIT_REJECTED_OVERLOAD) != 0) {
> // Forward RejectedOverload
> Message msg = DMT.createFNPRejectedOverload(uid, false);
> - source.sendAsync(msg, null, 0, null);
> + source.sendAsync(msg, null, 0, this);
> }
>
> if((waitStatus & RequestSender.WAIT_TRANSFERRING_DATA) != 0) {
> // Is a CHK.
> Message df = DMT.createFNPCHKDataFound(uid,
rs.getHeaders());
> - source.sendSync(df, null);
> + source.sendAsync(df, null, 0, this);
> +
> PartiallyReceivedBlock prb = rs.getPRB();
> BlockTransmitter bt =
> new BlockTransmitter(node.usm, source, uid, prb,
node.outputThrottle, this);
> @@ -190,6 +198,8 @@
> finishOpennetChecked();
> }
> status = rs.getStatus();
> + //for byte logging, since the block is the 'terminal'
message.
> + applyByteCounts();
This is fine btw, we wait for an explicit acknowledgement so we know the
blocks have been sent.
> + private boolean once=true;
> + public void sent() {
> + //For byte counting, this relies on the fact that the callback
will only be excuted once. This check might be paranoid.
> + if (once) {
> + applyByteCounts();
> + } else {
> + Logger.error(this, "terminalMessage sent multiple times?
for " + RequestHandler.this);
> + }
> + }
It's a sensible check but afaics you haven't implemented it - where is once
set to false?!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL:
<https://emu.freenetproject.org/pipermail/devl/attachments/20071207/5bd06be6/attachment.pgp>