I2NP: Don't extend DataStructureImpl, to save space

Fixup test as required
This commit is contained in:
zzz
2020-11-16 14:51:35 +00:00
parent 8644eb431e
commit 595f8762ab
5 changed files with 50 additions and 7 deletions

View File

@@ -15,9 +15,11 @@ import net.i2p.data.DataStructure;
/**
* Base interface for all I2NP messages
*
* Note: No longer extends DataStructure as of 0.9.48
*
* @author jrandom
*/
public interface I2NPMessage extends DataStructure {
public interface I2NPMessage {
/** 4 bytes unsigned */
public static final long MAX_ID_VALUE = (1l << 32) - 1l;
@@ -102,6 +104,11 @@ public interface I2NPMessage extends DataStructure {
/** How large the raw message is with the short 5 byte header */
public int getRawMessageSize();
/**
* @since 0.9.48 from DataStructure
*/
public byte[] toByteArray();
/**
* Write the message to the buffer, returning the new offset (NOT the length).
* the data is formatted so as to be self contained, with the type, size,

View File

@@ -25,9 +25,11 @@ import net.i2p.util.SimpleByteCache;
/**
* Defines the base message implementation.
*
* Note: No longer extends DataStructureImpl as of 0.9.48
*
* @author jrandom
*/
public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPMessage {
public abstract class I2NPMessageImpl implements I2NPMessage {
protected final Log _log;
protected final I2PAppContext _context;
protected long _expiration;
@@ -214,7 +216,6 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
return calculateWrittenLength()+5;
}
@Override
public byte[] toByteArray() {
byte data[] = new byte[getMessageSize()];
int written = toByteArray(data);

View File

@@ -18,10 +18,10 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 12;
public final static long BUILD = 13;
/** for example "-test" */
public final static String EXTRA = "";
public final static String EXTRA = "-rc";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
public static void main(String args[]) {
System.out.println("I2P Router version: " + FULL_VERSION);