* Data Structures:

- Make Destination and RouterIdentity keys and cert immutable
   - Add Destination cache
This commit is contained in:
zzz
2013-10-07 13:04:01 +00:00
parent 890f40b2ac
commit 31f117e74c
17 changed files with 176 additions and 40 deletions

View File

@ -1,5 +1,6 @@
package net.i2p.client.streaming;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Arrays;
@ -580,12 +581,15 @@ class Packet {
cur += 2;
}
if (isFlagSet(FLAG_FROM_INCLUDED)) {
Destination optionFrom = new Destination();
ByteArrayInputStream bais = new ByteArrayInputStream(buffer, cur, length - cur);
try {
cur += optionFrom.readBytes(buffer, cur);
Destination optionFrom = Destination.create(bais);
cur += optionFrom.size();
setOptionalFrom(optionFrom);
} catch (IOException ioe) {
throw new IllegalArgumentException("Bad from field", ioe);
} catch (DataFormatException dfe) {
throw new IllegalArgumentException("Bad from field: " + dfe.getMessage());
throw new IllegalArgumentException("Bad from field", dfe);
}
}
if (isFlagSet(FLAG_MAX_PACKET_SIZE_INCLUDED)) {
@ -631,10 +635,10 @@ class Packet {
Log l = ctx.logManager().getLog(Packet.class);
if (l.shouldLog(Log.WARN))
l.warn("Signature failed on " + toString(), new Exception("moo"));
if (false) {
l.error(Base64.encode(buffer, 0, size));
l.error("Signature: " + Base64.encode(_optionSignature.getData()));
}
//if (false) {
// l.error(Base64.encode(buffer, 0, size));
// l.error("Signature: " + Base64.encode(_optionSignature.getData()));
//}
}
return ok;
}