[freenet-dev] [freenet-cvs] r16388 - trunk/freenet/src/freenet/client/async

Matthew Toseland toad at amphibian.dyndns.org
Mon Dec 10 17:44:30 UTC 2007


On Monday 10 December 2007 16:34, Robert Hailey wrote:
> 
> On Dec 8, 2007, at 6:48 AM, Matthew Toseland wrote:
> 
> > On Friday 07 December 2007 02:13, you wrote:
> >
> > With regards to Timer: Why not just use the Ticker ? Admittedly they  
> > will
> > sometimes get scheduled in parallel, but iirc it doesn't do that  
> > much work
> > on-thread so it's not really a problem...
> 
> I was not aware of Ticker. It would seem to be more consistent with  
> the code base to use Ticker.

Have you implemented this?
> 
> >>
> >> Modified: trunk/freenet/src/freenet/client/async/USKFetcher.java
> >> ===================================================================
> >> --- trunk/freenet/src/freenet/client/async/USKFetcher.java	2007-12-07
> > 01:41:35 UTC (rev 16387)
> >> +++ trunk/freenet/src/freenet/client/async/USKFetcher.java	2007-12-07
> > 02:13:36 UTC (rev 16388)
> >> @@ -252,43 +255,28 @@
> >> 			long now = System.currentTimeMillis();
> >> 			synchronized(this) {
> >> 				started = false; // don't finish before have rescheduled
> >> +
> >> +                //Find out when we should check next ('end'), in an
> > increasing delay (unless we make progress).
> >> +                long newSleepTime = sleepTime * 2;
> >> +				if(newSleepTime > maxSleepTime) newSleepTime = maxSleepTime;
> >> +				sleepTime = newSleepTime;
> >> +				end = now + sleepTime;
> >> +
> >> 				if(valAtEnd > valueAtSchedule) {
> >> -					// Have advanced.
> >> +					// We have advanced; keep trying as if we just started.
> >> 					minFailures = origMinFailures;
> >> 					sleepTime = origSleepTime;
> >> +					end = now;
> >
> > end = now + origSleepTime. What you have there makes it retry  
> > *immediately*.
> 
> Correct. If a USKFetch makes progress it must retry with a distinct  
> window-of-five, and the original code appeared to do this immediately,  
> so I maintained that. This code should only be executed when the very  
> last fetch attempt is complete.

I thought it slept for origSleepTime in that case?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://emu.freenetproject.org/pipermail/devl/attachments/20071210/05473d5d/attachment.pgp 


More information about the Devl mailing list