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:
jrandom
2006-02-20 14:19:52 +00:00
committed by zzz
parent 222af6c090
commit 4b77ddedcc
28 changed files with 473 additions and 322 deletions
@@ -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;