Changeset f0b3815 for core


Ignore:
Timestamp:
Oct 13, 2018 10:41:16 AM (20 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
a9f95750
Parents:
ee57bd7
Message:

Data: Prep Lease and LeaseSet? for subclassing

Location:
core/java/src/net/i2p/data
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/data/Lease.java

    ree57bd7 rf0b3815  
    2424 */
    2525public class Lease extends DataStructureImpl {
    26     private Hash _gateway;
    27     private TunnelId _tunnelId;
    28     private Date _end;
    29     //private int _numSuccess;
    30     //private int _numFailure;
     26    protected Hash _gateway;
     27    protected TunnelId _tunnelId;
     28    protected Date _end;
    3129
    3230    public Lease() {
  • core/java/src/net/i2p/data/LeaseSet.java

    ree57bd7 rf0b3815  
    6161 */
    6262public class LeaseSet extends DatabaseEntry {
    63     private Destination _destination;
    64     private PublicKey _encryptionKey;
    65     private SigningPublicKey _signingKey;
     63    protected Destination _destination;
     64    protected PublicKey _encryptionKey;
     65    protected SigningPublicKey _signingKey;
    6666    // Keep leases in the order received, or else signature verification will fail!
    67     private final List<Lease> _leases;
    68     private boolean _receivedAsPublished;
     67    protected final List<Lease> _leases;
     68    protected boolean _receivedAsPublished;
    6969    private boolean _receivedAsReply;
    7070    // Store these since isCurrent() and getEarliestLeaseDate() are called frequently
    7171    private long _firstExpiration;
    72     private long _lastExpiration;
     72    protected long _lastExpiration;
    7373    private List<Lease> _decryptedLeases;
    7474    private boolean _decrypted;
    75     private boolean _checked;
     75    protected boolean _checked;
    7676    // cached byte version
    77     private volatile byte _byteified[];
     77    protected volatile byte _byteified[];
    7878
    7979    /**
     
    289289    }
    290290
     291    /** without sig! */
    291292    protected byte[] getBytes() {
    292293        if (_byteified != null) return _byteified;
    293294        if ((_destination == null) || (_encryptionKey == null) || (_signingKey == null))
    294295            return null;
    295         int len = _destination.size()
    296                 + PublicKey.KEYSIZE_BYTES // encryptionKey
    297                 + _signingKey.length() // signingKey
    298                 + 1
    299                 + _leases.size() * 44; // leases
     296        int len = size();
    300297        ByteArrayOutputStream out = new ByteArrayOutputStream(len);
    301298        try {
     
    304301            _signingKey.writeBytes(out);
    305302            out.write((byte) _leases.size());
    306             for (Lease lease : _leases)
     303            for (Lease lease : _leases) {
    307304                lease.writeBytes(out);
     305            }
    308306        } catch (IOException ioe) {
    309307            return null;
     
    362360        _signingKey.writeBytes(out);
    363361        out.write((byte) _leases.size());
    364         for (Lease lease : _leases)
     362        for (Lease lease : _leases) {
    365363            lease.writeBytes(out);
     364        }
    366365        _signature.writeBytes(out);
    367366    }
     
    375374             + _signingKey.length() // signingKey
    376375             + 1 // number of leases
    377              + _leases.size() * (Hash.HASH_LENGTH + 4 + 8);
     376             + _leases.size() * 44;
    378377    }
    379378   
     
    389388               && DataHelper.eq(_signingKey, ls.getSigningKey())
    390389               && DataHelper.eq(_destination, ls.getDestination());
    391 
    392390    }
    393391   
Note: See TracChangeset for help on using the changeset viewer.