On Friday 11 January 2008 23:50, Robert Hailey wrote:
>
> I had just translated this bug to the prioritized queue... I kept the
> logic the same, but I knew it didn't look right!
>
> All messages requeued in the past before r17024 (which is to say, a
> lot of messages, because nodes are busy), are requeued in the reverse
> order. Statistically, they may be requeued again (and flipped back).
>
> With this bug gone (plus the priority queue) the insanely-long-request-
> searching has vanished!
Cool!
>
> --
> Robert Hailey
>
> On Jan 11, 2008, at 5:45 PM, robert at freenetproject.org wrote:
>
> > Author: robert
> > Date: 2008-01-11 23:45:09 +0000 (Fri, 11 Jan 2008)
> > New Revision: 17024
> >
> > Modified:
> > trunk/freenet/src/freenet/node/PeerNode.java
> > Log:
> > requeue messages in the correct order... *long-standing-bug*
> >
> >
> > Modified: trunk/freenet/src/freenet/node/PeerNode.java
> > ===================================================================
> > --- trunk/freenet/src/freenet/node/PeerNode.java 2008-01-11 23:22:03
> > UTC (rev 17023)
> > +++ trunk/freenet/src/freenet/node/PeerNode.java 2008-01-11 23:45:09
> > UTC (rev 17024)
> > @@ -999,6 +999,25 @@
> > }
> >
> > /**
> > + * like enqueuePrioritizedMessageItem, but adds it to the front of
> > those in the same priority.
> > + */
> > + private void pushfrontPrioritizedMessageItem(MessageItem addMe) {
> > + synchronized (messagesToSendNow) {
> > + //Assume it goes on the end, both the common case and
> > an
> > accelerator for requeueing.
> > + ListIterator
> > i=messagesToSendNow.listIterator(messagesToSendNow.size());
> > + while (i.hasPrevious()) {
> > + MessageItem here=(MessageItem)i.previous();
> > + //While the item we are adding is NOT-LESS-THAN
> > priority, move
> > on (backwards...)
> > + if (!(addMe.getPriority() <=
> > here.getPriority())) {
> > + i.next();
> > + break;
> > + }
> > + }
> > + i.add(addMe);
> > + }
> > + }
> > +
> > + /**
> > * Returns the number of milliseconds that it is estimated to take
> > to transmit the currently queued packets.
> > */
> > public long getProbableSendQueueTime() {
> > @@ -1186,7 +1205,7 @@
> > synchronized(messagesToSendNow) {
> > for(int i = offset; i < offset + length; i++)
> > if(messages[i] != null)
> > -
> > enqueuePrioritizedMessageItem(messages[i]);
> > +
> > pushfrontPrioritizedMessageItem(messages[i]);
> > }
> > }
-------------- 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/20080112/08ae3c16/attachment.pgp>