Author: toad
Date: 2008-03-13 00:17:05 +0000 (Thu, 13 Mar 2008)
New Revision: 18490

Modified:
   trunk/freenet/src/freenet/node/FNPPacketMangler.java
Log:
authenticatorCache wasn't working. This was causing unmatchable packets.
It was using byte[] as a key, and assuming it would work by value. It doesn't, 
it works by pointer i.e. it doesn't work. Use ByteArrayWrapper, as we do 
elsewhere.

Modified: trunk/freenet/src/freenet/node/FNPPacketMangler.java
===================================================================
--- trunk/freenet/src/freenet/node/FNPPacketMangler.java        2008-03-13 
00:12:51 UTC (rev 18489)
+++ trunk/freenet/src/freenet/node/FNPPacketMangler.java        2008-03-13 
00:17:05 UTC (rev 18490)
@@ -40,6 +40,7 @@
 import freenet.io.comm.PacketSocketHandler;
 import freenet.io.comm.Peer;
 import freenet.io.comm.PeerContext;
+import freenet.support.ByteArrayWrapper;
 import freenet.support.HexUtil;
 import freenet.support.Logger;
 import freenet.support.SimpleFieldSet;
@@ -928,7 +929,7 @@
                // Now simply transmit the corresponding message3
                Object message3 = null;
                synchronized (authenticatorCache) {
-                       message3 = authenticatorCache.get(authenticator);
+                       message3 = authenticatorCache.get(new 
ByteArrayWrapper(authenticator));
                }
                if(message3 != null) {
                        Logger.normal(this, "We replayed a message from the 
cache (shouldn't happen often) - "+pn.getPeer());
@@ -1053,7 +1054,7 @@
                // Now simply transmit the corresponding message4
                Object message4 = null;
                synchronized (authenticatorCache) {
-                       message4 = authenticatorCache.get(authenticator);
+                       message4 = authenticatorCache.get(new 
ByteArrayWrapper(authenticator));
                }
                if(message4 != null) {
                        Logger.normal(this, "We replayed a message from the 
cache (shouldn't happen often) - "+pn);
@@ -1462,7 +1463,7 @@
                // cache the message
                synchronized (authenticatorCache) {
                        if(!maybeResetTransientKey())
-                               authenticatorCache.put(authenticator,message3);
+                               authenticatorCache.put(new 
ByteArrayWrapper(authenticator),message3);
                }
                if(unknownInitiator)
                        sendAnonAuthPacket(1, 2, 2, setupType, message3, pn, 
replyTo, pn.anonymousInitiatorSetupCipher);
@@ -1556,7 +1557,7 @@
                // cache the message
                synchronized (authenticatorCache) {
                        if(!maybeResetTransientKey())
-                               authenticatorCache.put(authenticator, message4);
+                               authenticatorCache.put(new 
ByteArrayWrapper(authenticator), message4);
                }

                if(unknownInitiator)


Reply via email to