On Friday 14 March 2008 20:35, Robert Hailey wrote:
> 
> On Mar 14, 2008, at 12:30 PM, Matthew Toseland wrote:
> 
> > On Friday 14 March 2008 15:40, Robert Hailey wrote:
> >>
> >> [...]
> >>
> >> Unless I read this wrong you have inverted the return value
> >> (isLocalAddress()==!shouldThrottle()), but did not negate the
> >> condition where it is used.
> >>
> >> The code in PacketThrottle now reads:
> >>
> >> if (should NOT throttle) {
> >>    log("throttling");
> >>    ...
> >> }
> >
> > You're right... I don't understand why the simulation worked in that  
> > case...
> 
> Well... the real problem would have been if it had got to the live  
> network (no throttling where it needs it), in the sim it was just  
> throttling where it didn't need to.
> 
> Along the same lines... shouldn't we not report that they have already  
> been reported? Unless this is how we get fast local transfers in the  
> first place (mis-reporting). Something like this:

Fair point... but if it's not throttled, we shouldn't report it at all, even 
in sendAsync()... so the fix is a bit deeper... Let me know if you need me to 
deal with it.
> 
> Index: src/freenet/io/xfer/PacketThrottle.java
> ===================================================================
> --- src/freenet/io/xfer/PacketThrottle.java   (revision 18536)
> +++ src/freenet/io/xfer/PacketThrottle.java   (working copy)
> @@ -210,15 +210,17 @@
>                       Logger.minor(this, "Congestion control wait time: 
> "+waitTime+"  
> for "+this);
>               MyCallback callback = new MyCallback();
>               try {
> +                     int alreadyReportedBytes=0;
>                       if(((PeerNode)peer).shouldThrottle()) {
>                               if(logMINOR) Logger.minor(this, "Throttling  
> "+peer.shortToString()+" : "+packetSize+" for "+this);
>                               long startTime = System.currentTimeMillis();
>                               overallThrottle.blockingGrab(packetSize);
> +                             alreadyReportedBytes=packetSize;
>                               long delayTime = System.currentTimeMillis() - 
> startTime;
>                               
> ((PeerNode)peer).reportThrottledPacketSendTime(delayTime);
>                       } else if(logMINOR)
>                               Logger.minor(this, "Not throttling 
> "+peer.shortToString()+" for  
> "+this);
> -                     peer.sendAsync(msg, callback, packetSize, ctr);
> +                     peer.sendAsync(msg, callback, alreadyReportedBytes, 
> ctr);
>               } catch (RuntimeException e) {
>                       callback.fatalError();
>                       throw e;
> 
> --
> Robert Hailey
> 
> 
-------------- 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/20080315/ac22b0b0/attachment.pgp>

Reply via email to