On Thursday 10 January 2008 00:33, robert at freenetproject.org wrote:
> Author: robert
> Date: 2008-01-10 00:33:13 +0000 (Thu, 10 Jan 2008)
> New Revision: 16990
>
> Modified:
> trunk/freenet/src/freenet/io/xfer/BlockReceiver.java
> Log:
> tell the transmitter if we are not listening anymore, and why
Interesting. This is because we register senders, so we can tell them that we
aborted, but we don't register receivers, so abort() can't tell them.
I have wondered about dumping Block* in favour of Bulk* in the next iteration
of the low-level code - we don't need most of Block*'s complexity, since the
next layer down provides reliable packet delivery anyway.
>
> Modified: trunk/freenet/src/freenet/io/xfer/BlockReceiver.java
> ===================================================================
> --- trunk/freenet/src/freenet/io/xfer/BlockReceiver.java 2008-01-10
> 00:15:37
UTC (rev 16989)
> +++ trunk/freenet/src/freenet/io/xfer/BlockReceiver.java 2008-01-10
> 00:33:13
UTC (rev 16990)
> @@ -51,6 +51,7 @@
> /** packet : Integer -> reportTime : Long * */
> HashMap _recentlyReportedMissingPackets = new HashMap();
> ByteCounter _ctr;
> + boolean sentAborted;
>
> public BlockReceiver(MessageCore usm, PeerContext sender, long uid,
PartiallyReceivedBlock prb, ByteCounter ctr) {
> _sender = sender;
> @@ -62,6 +63,7 @@
>
> public void sendAborted(int reason, String desc) throws
NotConnectedException {
> _usm.send(_sender, DMT.createSendAborted(_uid, reason, desc),
> _ctr);
> + sentAborted=true;
> }
>
> public byte[] receive() throws RetrievalException {
> @@ -153,6 +155,14 @@
> // We didn't cause it?!
> Logger.error(this, "Caught in receive - probably a bug
> as receive sets
it: "+e);
> throw new
> RetrievalException(RetrievalException.UNKNOWN, "Aborted?");
> + } finally {
> + try {
> + if (_prb.isAborted() && !sentAborted) {
> + sendAborted(_prb.getAbortReason(),
> _prb.getAbortDescription());
> + }
> + } catch (NotConnectedException e) {
> + //ignore
> + }
> }
> }
> }
>
> _______________________________________________
> cvs mailing list
> cvs at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
>
>
-------------- 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/20080111/197f75b3/attachment.pgp>