mirror of
https://github.com/i2p/i2p.i2p.git
synced 2026-04-28 08:25:35 +00:00
2006-02-20 jrandom
* Major SSU and router tuning to reduce contention, memory usage, and GC
churn. There are still issues to be worked out, but this should be a
substantial improvement.
* Modified the optional netDb harvester task to support choosing whether
to use (non-anonymous) direct connections or (anonymous) exploratory
tunnels to do the harvesting. Harvesting itself is enabled via the
advanced config "netDb.shouldHarvest=true" (default is false) and the
connection type can be chosen via "netDb.harvestDirectly=false" (default
is false).
This commit is contained in:
@@ -28,8 +28,14 @@ public class GarlicMessage extends I2NPMessageImpl {
|
||||
setData(null);
|
||||
}
|
||||
|
||||
public byte[] getData() { return _data; }
|
||||
public void setData(byte[] data) { _data = data; }
|
||||
public byte[] getData() {
|
||||
verifyUnwritten();
|
||||
return _data;
|
||||
}
|
||||
public void setData(byte[] data) {
|
||||
verifyUnwritten();
|
||||
_data = data;
|
||||
}
|
||||
|
||||
public void readMessage(byte data[], int offset, int dataSize, int type) throws I2NPMessageException, IOException {
|
||||
if (type != MESSAGE_TYPE) throw new I2NPMessageException("Message type is incorrect for this message");
|
||||
@@ -43,11 +49,13 @@ public class GarlicMessage extends I2NPMessageImpl {
|
||||
}
|
||||
|
||||
/** calculate the message body's length (not including the header and footer */
|
||||
protected int calculateWrittenLength() {
|
||||
protected int calculateWrittenLength() {
|
||||
verifyUnwritten();
|
||||
return 4 + _data.length;
|
||||
}
|
||||
/** write the message body to the output array, starting at the given index */
|
||||
protected int writeMessageBody(byte out[], int curIndex) throws I2NPMessageException {
|
||||
verifyUnwritten();
|
||||
byte len[] = DataHelper.toLong(4, _data.length);
|
||||
System.arraycopy(len, 0, out, curIndex, 4);
|
||||
curIndex += 4;
|
||||
@@ -62,6 +70,11 @@ public class GarlicMessage extends I2NPMessageImpl {
|
||||
return DataHelper.hashCode(getData());
|
||||
}
|
||||
|
||||
protected void written() {
|
||||
super.written();
|
||||
_data = null;
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if ( (object != null) && (object instanceof GarlicMessage) ) {
|
||||
GarlicMessage msg = (GarlicMessage)object;
|
||||
|
||||
Reference in New Issue
Block a user