Changeset f1e9f5d4


Ignore:
Timestamp:
Dec 2, 2014 1:28:48 PM (6 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
4b2715c
Parents:
2d43d34
Message:

DatabaseStoreMessage?: Mask the unused bits in the type field,
in case we ever want to use them for options

File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/data/i2np/DatabaseStoreMessage.java

    r2d43d34 rf1e9f5d4  
    106106        curIndex += Hash.HASH_LENGTH;
    107107       
    108         type = (int)DataHelper.fromLong(data, curIndex, 1);
     108        // as of 0.9.18, ignore other 7 bits of the type byte, in preparation for future options
     109        int dbType = data[curIndex] & 0x01;
    109110        curIndex++;
    110111       
     
    125126        }
    126127       
    127         if (type == DatabaseEntry.KEY_TYPE_LEASESET) {
     128        if (dbType == DatabaseEntry.KEY_TYPE_LEASESET) {
    128129            _dbEntry = new LeaseSet();
    129130            try {
     
    134135                throw new I2NPMessageException("Error reading the leaseSet", ioe);
    135136            }
    136         } else if (type == DatabaseEntry.KEY_TYPE_ROUTERINFO) {
     137        } else {   // dbType == DatabaseEntry.KEY_TYPE_ROUTERINFO
    137138            _dbEntry = new RouterInfo();
    138139            int compressedSize = (int)DataHelper.fromLong(data, curIndex, 2);
     
    155156                throw new I2NPMessageException("Corrupt compressed routerInfo size = " + compressedSize, ioe);
    156157            }
    157         } else {
    158             throw new I2NPMessageException("Invalid type of key read from the structure - " + type);
    159158        }
    160159        //if (!key.equals(_dbEntry.getHash()))
Note: See TracChangeset for help on using the changeset viewer.