Author: nextgens
Date: 2007-09-30 08:43:26 +0000 (Sun, 30 Sep 2007)
New Revision: 15414
Modified:
trunk/freenet/src/freenet/node/FNPPacketMangler.java
Log:
JFK: get rid of serialization in the cache.
Modified: trunk/freenet/src/freenet/node/FNPPacketMangler.java
===================================================================
--- trunk/freenet/src/freenet/node/FNPPacketMangler.java 2007-09-30
08:40:45 UTC (rev 15413)
+++ trunk/freenet/src/freenet/node/FNPPacketMangler.java 2007-09-30
08:43:26 UTC (rev 15414)
@@ -39,9 +39,6 @@
import freenet.support.StringArray;
import freenet.support.TimeUtil;
import freenet.support.WouldBlockException;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.util.HashMap;
@@ -646,11 +643,7 @@
}
if(message3 != null) {
Logger.normal(this, "We replayed a message from the
cache (shouldn't happen often) -"+pn);
- try{
- sendAuthPacket(1, 2, 3, getBytes(message3), pn,
replyTo);
- }catch(IOException e){
- Logger.error(this,"Error getting bytes... wtf ?
"+e.getMessage(), e);
- }
+ sendAuthPacket(1, 2, 3, (byte[]) message3, pn, replyTo);
return;
}
@@ -765,11 +758,7 @@
}
if(message4 != null) {
Logger.normal(this, "We replayed a message from the
cache (shouldn't happen often) - "+pn);
- try{
- sendAuthPacket(1, 2, 3, getBytes(message4), pn,
replyTo);
- }catch(IOException e){
- Logger.error(this,"Error getting bytes... wtf ?
"+e.getMessage(), e);
- }
+ sendAuthPacket(1, 2, 3, (byte[]) message4, pn, replyTo);
return;
}
@@ -1000,21 +989,6 @@
}
/*
- * Convert Object to byteArray
- */
- private byte[] getBytes(Object o) throws IOException
- {
- ByteArrayOutputStream bs = new ByteArrayOutputStream();
- ObjectOutputStream os = new ObjectOutputStream(bs);
- os.writeObject(o);
- os.flush();
- os.close();
- bs.close();
- byte [] output = bs.toByteArray();
- return output;
- }
-
- /*
* Format:
* Ni, Nr, g^i, g^r
* Authenticator - HMAC{g^ir}(g^r, Nr, Ni, IP)