On Friday 14 March 2008 15:40, Robert Hailey wrote:
> 
> On Mar 13, 2008, at 5:29 PM, toad at freenetproject.org wrote:
> 
> > Author: toad
> > Date: 2008-03-13 22:29:00 +0000 (Thu, 13 Mar 2008)
> > New Revision: 18520
> >
> > Modified:
> >   trunk/freenet/src/freenet/io/xfer/PacketThrottle.java
> >   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
> >   trunk/freenet/src/freenet/node/Node.java
> >   trunk/freenet/src/freenet/node/NodeStarter.java
> >   trunk/freenet/src/freenet/node/PeerNode.java
> >   trunk/freenet/src/freenet/node/simulator/ 
> > RealNodeBusyNetworkTest.java
> >   trunk/freenet/src/freenet/node/simulator/ 
> > RealNodeNetworkColoringTest.java
> >   trunk/freenet/src/freenet/node/simulator/RealNodePingTest.java
> >   trunk/freenet/src/freenet/node/simulator/ 
> > RealNodeRequestInsertTest.java
> >   trunk/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java
> >   trunk/freenet/src/freenet/node/simulator/RealNodeSecretPingTest.java
> >   trunk/freenet/src/freenet/node/simulator/RealNodeULPRTest.java
> > Log:
> > isLocal() -> !shouldThrottle().
> > New config option throttleLocalTraffic.
> > Enable it in the simulator, if and only if we want limiting in this  
> > simulation.
> >
> > Modified: trunk/freenet/src/freenet/io/xfer/PacketThrottle.java
> > ===================================================================
> > --- trunk/freenet/src/freenet/io/xfer/PacketThrottle.java   2008-03-13  
> > 22:20:30 UTC (rev 18519)
> > +++ trunk/freenet/src/freenet/io/xfer/PacketThrottle.java   2008-03-13  
> > 22:29:00 UTC (rev 18520)
> > @@ -191,7 +191,7 @@
> >                     Logger.minor(this, "Congestion control wait time: 
> > "+waitTime+"  
> > for "+this);
> >             MyCallback callback = new MyCallback();
> >             try {
> > -                   if(!((PeerNode)peer).isLocalAddress()) {
> > +                   if(!((PeerNode)peer).shouldThrottle()) {
> >                             if(logMINOR) Logger.minor(this, "Throttling  
> > "+peer.shortToString()+" : "+packetSize+" for "+this);
> >                             long startTime = System.currentTimeMillis();
> >                             overallThrottle.blockingGrab(packetSize);
> >
> > [...]
> > Modified: trunk/freenet/src/freenet/node/PeerNode.java
> > ===================================================================
> > --- trunk/freenet/src/freenet/node/PeerNode.java    2008-03-13 22:20:30  
> > UTC (rev 18519)
> > +++ trunk/freenet/src/freenet/node/PeerNode.java    2008-03-13 22:29:00  
> > UTC (rev 18520)
> > @@ -3701,10 +3701,11 @@
> >                     sendAsync(DMT.createFNPNetworkID(assignedNetworkID), 
> > null, 0, ctr);
> >     }
> >
> > -   public boolean isLocalAddress() {
> > +   public boolean shouldThrottle() {
> >             Peer peer = getPeer();
> > -           if(peer == null) return false; // presumably
> > -           return !IPUtil.isValidAddress(peer.getAddress(), false);
> > +           if(node.throttleLocalData) return true;
> > +           if(peer == null) return true; // presumably
> > +           return IPUtil.isValidAddress(peer.getAddress(), false);
> >     }
> 
> 
> 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...
-------------- 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/20080314/2cd9e0f8/attachment.pgp>

Reply via email to