Author: toad
Date: 2008-03-18 22:03:39 +0000 (Tue, 18 Mar 2008)
New Revision: 18563

Modified:
   trunk/freenet/src/freenet/node/FNPPacketMangler.java
Log:
Doh

Modified: trunk/freenet/src/freenet/node/FNPPacketMangler.java
===================================================================
--- trunk/freenet/src/freenet/node/FNPPacketMangler.java        2008-03-18 
21:55:33 UTC (rev 18562)
+++ trunk/freenet/src/freenet/node/FNPPacketMangler.java        2008-03-18 
22:03:39 UTC (rev 18563)
@@ -2358,10 +2358,12 @@
                // Ideally we'd mimic the size profile - and the session bytes! 
- of a common protocol.

                int REMAINING_OVERHEAD = 32;
-               int paddedLen = ((packetLength + REMAINING_OVERHEAD + 63) / 64) 
* 64;
+               packetLength += REMAINING_OVERHEAD;
+               int paddedLen = ((packetLength + 63) / 64) * 64;
                paddedLen += node.fastWeakRandom.nextInt(64);
                if(packetLength <= 1280 && paddedLen > 1280) paddedLen = 1280;
                paddedLen -= REMAINING_OVERHEAD;
+               packetLength -= REMAINING_OVERHEAD;

                byte[] padding = new byte[paddedLen - packetLength];
                node.fastWeakRandom.nextBytes(padding);


Reply via email to