forked from I2P_Developers/i2p.i2p
Data: Move LS RAP/RAR booleans up to superclass
Add RAR to I2NP DSM WIP
This commit is contained in:
@@ -62,6 +62,8 @@ public abstract class DatabaseEntry extends DataStructureImpl {
|
||||
// synch: this
|
||||
private Hash _currentRoutingKey;
|
||||
private long _routingKeyGenMod;
|
||||
protected boolean _receivedAsPublished;
|
||||
protected boolean _receivedAsReply;
|
||||
|
||||
/**
|
||||
* A common interface to the timestamp of the two subclasses.
|
||||
@@ -253,4 +255,33 @@ public abstract class DatabaseEntry extends DataStructureImpl {
|
||||
return false;
|
||||
return DSAEngine.getInstance().verifySignature(_signature, data, spk);
|
||||
}
|
||||
|
||||
/**
|
||||
* If true, we received this LeaseSet by a remote peer publishing it to
|
||||
* us, rather than by searching for it ourselves or locally creating it.
|
||||
* Default false.
|
||||
*
|
||||
* @since 0.9.58 moved up from LeaseSet
|
||||
*/
|
||||
public boolean getReceivedAsPublished() { return _receivedAsPublished; }
|
||||
|
||||
/**
|
||||
* @since 0.9.58 moved up from LeaseSet
|
||||
*/
|
||||
public void setReceivedAsPublished(boolean received) { _receivedAsPublished = received; }
|
||||
|
||||
/**
|
||||
* If true, we received this LeaseSet by searching for it
|
||||
* Default false.
|
||||
*
|
||||
* @since 0.7.14, moved up from LeaseSet in 0.9.58
|
||||
*/
|
||||
public boolean getReceivedAsReply() { return _receivedAsReply; }
|
||||
|
||||
/**
|
||||
* set to true
|
||||
*
|
||||
* @since 0.7.14, moved up from LeaseSet in 0.9.58
|
||||
*/
|
||||
public void setReceivedAsReply() { _receivedAsReply = true; }
|
||||
}
|
||||
|
||||
@@ -68,8 +68,6 @@ public class LeaseSet extends DatabaseEntry {
|
||||
protected SigningPublicKey _signingKey;
|
||||
// Keep leases in the order received, or else signature verification will fail!
|
||||
protected final List<Lease> _leases;
|
||||
protected boolean _receivedAsPublished;
|
||||
private boolean _receivedAsReply;
|
||||
private Hash _receivedBy;
|
||||
// Store these since isCurrent() and getEarliestLeaseDate() are called frequently
|
||||
private long _firstExpiration;
|
||||
@@ -186,29 +184,6 @@ public class LeaseSet extends DatabaseEntry {
|
||||
throw new IllegalArgumentException("Signing key type mismatch");
|
||||
_signingKey = key;
|
||||
}
|
||||
|
||||
/**
|
||||
* If true, we received this LeaseSet by a remote peer publishing it to
|
||||
* us, rather than by searching for it ourselves or locally creating it.
|
||||
* Default false.
|
||||
*/
|
||||
public boolean getReceivedAsPublished() { return _receivedAsPublished; }
|
||||
|
||||
/** Default false */
|
||||
public void setReceivedAsPublished(boolean received) { _receivedAsPublished = received; }
|
||||
|
||||
/**
|
||||
* If true, we received this LeaseSet by searching for it
|
||||
* Default false.
|
||||
* @since 0.7.14
|
||||
*/
|
||||
public boolean getReceivedAsReply() { return _receivedAsReply; }
|
||||
|
||||
/**
|
||||
* set to true
|
||||
* @since 0.7.14
|
||||
*/
|
||||
public void setReceivedAsReply() { _receivedAsReply = true; }
|
||||
|
||||
/**
|
||||
* The Hash of the local client that received this LS,
|
||||
|
||||
@@ -41,6 +41,7 @@ public class DatabaseStoreMessage extends FastI2NPMessageImpl {
|
||||
private long _replyToken;
|
||||
private TunnelId _replyTunnel;
|
||||
private Hash _replyGateway;
|
||||
private boolean _receivedAsReply;
|
||||
|
||||
public DatabaseStoreMessage(I2PAppContext context) {
|
||||
super(context);
|
||||
@@ -101,6 +102,23 @@ public class DatabaseStoreMessage extends FastI2NPMessageImpl {
|
||||
public Hash getReplyGateway() { return _replyGateway; }
|
||||
public void setReplyGateway(Hash peer) { _replyGateway = peer; }
|
||||
|
||||
/**
|
||||
* If true, we received this by searching for it.
|
||||
* Note that searches may query multiple peers in parallel;
|
||||
* only the first reply may have this set, and a reply
|
||||
* received after the reply job times out will not have this set.
|
||||
* Default false.
|
||||
*
|
||||
* @since 0.9.58
|
||||
*/
|
||||
public boolean getReceivedAsReply() { return _receivedAsReply; }
|
||||
|
||||
/**
|
||||
* set to true
|
||||
* @since 0.9.58
|
||||
*/
|
||||
public void setReceivedAsReply() { _receivedAsReply = true; }
|
||||
|
||||
public void readMessage(byte data[], int offset, int dataSize, int type) throws I2NPMessageException {
|
||||
if (type != MESSAGE_TYPE) throw new I2NPMessageException("Message type is incorrect for this message");
|
||||
int curIndex = offset;
|
||||
|
||||
Reference in New Issue
Block a user