Author: toad
Date: 2007-02-16 14:16:05 +0000 (Fri, 16 Feb 2007)
New Revision: 11811

Modified:
   trunk/freenet/src/freenet/keys/ClientCHK.java
Log:
Pool extra bytes... sort of.

Modified: trunk/freenet/src/freenet/keys/ClientCHK.java
===================================================================
--- trunk/freenet/src/freenet/keys/ClientCHK.java       2007-02-16 14:15:38 UTC 
(rev 11810)
+++ trunk/freenet/src/freenet/keys/ClientCHK.java       2007-02-16 14:16:05 UTC 
(rev 11811)
@@ -7,6 +7,7 @@
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.net.MalformedURLException;
+import java.util.Arrays;

 import freenet.support.Base64;

@@ -108,6 +109,8 @@
                dos.write(cryptoKey);
        }

+       static byte[] lastExtra;
+       
        public byte[] getExtra() {
                byte[] extra = new byte[EXTRA_LENGTH];
                extra[0] = (byte) (cryptoAlgorithm >> 8);
@@ -115,6 +118,10 @@
                extra[2] = (byte) (controlDocument ? 2 : 0);
                extra[3] = (byte) (compressionAlgorithm >> 8);
                extra[4] = (byte) compressionAlgorithm;
+               byte[] last = lastExtra;
+               // No synchronization required IMHO
+               if(Arrays.equals(last, extra)) return last;
+               lastExtra = extra;
                return extra;
        }



Reply via email to