Compare commits

...

1 Commits

Author SHA1 Message Date
eyedeekay
fb8bb645c2 Router: move getReceivedBy and getReceivedAsPublished into DatabaseEntry 2023-10-16 20:47:27 -04:00
4 changed files with 25 additions and 28 deletions

View File

@@ -62,8 +62,27 @@ public abstract class DatabaseEntry extends DataStructureImpl {
// synch: this
private Hash _currentRoutingKey;
private long _routingKeyGenMod;
protected boolean _receivedAsPublished;
protected boolean _receivedAsReply;
private boolean _receivedAsPublished;
private boolean _receivedAsReply;
/**
* Hash of the client receiving the routerinfo, or null if it was sent directly.
*/
private Hash _receivedBy;
/**
* The Hash of the local client that received this LS,
* null if the router or unknown.
*
* @since 0.9.47
*/
public Hash getReceivedBy() {
return _receivedBy;
}
public void setReceivedBy(Hash receivedBy) {
this._receivedBy = receivedBy;
}
/**
* A common interface to the timestamp of the two subclasses.

View File

@@ -68,7 +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;
private Hash _receivedBy;
// Store these since isCurrent() and getEarliestLeaseDate() are called frequently
private long _firstExpiration;
protected long _lastExpiration;
@@ -185,22 +184,14 @@ public class LeaseSet extends DatabaseEntry {
_signingKey = key;
}
/**
* The Hash of the local client that received this LS,
* null if the router or unknown.
*
* @since 0.9.47
*/
public Hash getReceivedBy() { return _receivedBy; }
/**
* Also sets receivedAsReply to true
* @param localClient may be null
* @since 0.9.47
*/
public void setReceivedBy(Hash localClient) {
_receivedAsReply = true;
_receivedBy = localClient;
super.setReceivedBy(localClient);
super.setReceivedAsReply();
}
/**
@@ -331,7 +322,7 @@ public class LeaseSet extends DatabaseEntry {
}
byte rv[] = out.toByteArray();
// if we are floodfill and this was published to us
if (_receivedAsPublished)
if (getReceivedAsPublished())
_byteified = rv;
return rv;
}

View File

@@ -396,7 +396,7 @@ public class LeaseSet2 extends LeaseSet {
}
byte rv[] = out.toByteArray();
// if we are floodfill and this was published to us
if (_receivedAsPublished)
if (getReceivedAsPublished())
_byteified = rv;
return rv;
}

View File

@@ -86,19 +86,6 @@ public class RouterInfo extends DatabaseEntry {
public static final String PROP_CAPABILITIES = "caps";
public static final char CAPABILITY_HIDDEN = 'H';
private static final int MAX_ADDRESSES = 16;
/**
* Hash of the client receiving the routerinfo, or null if it was sent directly.
*/
private Hash _receivedBy;
public Hash getReceivedBy() {
return _receivedBy;
}
public void setReceivedBy(Hash _receivedBy) {
this._receivedBy = _receivedBy;
}
/** Public string of chars which serve as bandwidth capacity markers
* NOTE: individual chars defined in Router.java