Changeset 95366c0


Ignore:
Timestamp:
Mar 7, 2019 2:46:20 PM (17 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
409207e0
Parents:
5b1b4ac
Message:

NetDB: Minor performance improvement in selectors
log tweaks

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • history.txt

    r5b1b4ac r95366c0  
     12019-03-06 zzz
     2 * NetDB: Fix flood version check, add version check for RedDSA
     3
    142019-03-05 zzz
    25 * Data: Update Encrypted LS2 blinding and encryption
  • router/java/src/net/i2p/router/RouterVersion.java

    r5b1b4ac r95366c0  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 13;
     21    public final static long BUILD = 14;
    2222
    2323    /** for example "-test" */
    24     public final static String EXTRA = "";
     24    public final static String EXTRA = "-rc";
    2525    public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
    2626    public static void main(String args[]) {
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodOnlyLookupMatchJob.java

    r5b1b4ac r95366c0  
    3737
    3838    public void setMessage(I2NPMessage message) {
    39         if (message instanceof DatabaseSearchReplyMessage) {
     39        if (message.getType() == DatabaseSearchReplyMessage.MESSAGE_TYPE) {
    4040            // DSRM processing now in FloodOnlyLookupSelector instead of here,
    4141            // a dsrm is only passed in when there are no more lookups remaining
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodOnlyLookupSelector.java

    r5b1b4ac r95366c0  
    3131    public boolean isMatch(I2NPMessage message) {
    3232        if (message == null) return false;
    33         if (message instanceof DatabaseStoreMessage) {
     33        int type = message.getType();
     34        if (type == DatabaseStoreMessage.MESSAGE_TYPE) {
    3435            DatabaseStoreMessage dsm = (DatabaseStoreMessage)message;
    3536            // is it worth making sure the reply came in on the right tunnel?
     
    3940                return true;
    4041            }
    41         } else if (message instanceof DatabaseSearchReplyMessage) {
     42        } else if (type == DatabaseSearchReplyMessage.MESSAGE_TYPE) {
    4243            DatabaseSearchReplyMessage dsrm = (DatabaseSearchReplyMessage)message;
    4344            if (_search.getKey().equals(dsrm.getSearchKey())) {
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillNetworkDatabaseFacade.java

    r5b1b4ac r95366c0  
    570570             _context.router().getUptime() < DONT_FAIL_PERIOD ||
    571571             _context.commSystem().countActivePeers() <= MIN_ACTIVE_PEERS)) {
    572             if (_log.shouldLog(Log.WARN))
    573                 _log.warn("Not failing " + peer.toBase64() + " as we are just starting up or have problems");
     572            if (_log.shouldInfo())
     573                _log.info("Not failing " + peer.toBase64() + " as we are just starting up or have problems");
    574574            return;
    575575        }
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillVerifyStoreJob.java

    r5b1b4ac r95366c0  
    256256        public long getExpiration() { return _expiration; }
    257257        public boolean isMatch(I2NPMessage message) {
    258             if (message instanceof DatabaseStoreMessage) {
     258            int type = message.getType();
     259            if (type == DatabaseStoreMessage.MESSAGE_TYPE) {
    259260                DatabaseStoreMessage dsm = (DatabaseStoreMessage)message;
    260261                return _key.equals(dsm.getKey());
    261             } else if (message instanceof DatabaseSearchReplyMessage) {
     262            } else if (type == DatabaseSearchReplyMessage.MESSAGE_TYPE) {
    262263                DatabaseSearchReplyMessage dsrm = (DatabaseSearchReplyMessage)message;
    263264                return _key.equals(dsrm.getSearchKey());
  • router/java/src/net/i2p/router/networkdb/kademlia/IterativeLookupSelector.java

    r5b1b4ac r95366c0  
    3939    public boolean isMatch(I2NPMessage message) {
    4040        if (message == null) return false;
    41         if (message instanceof DatabaseStoreMessage) {
     41        int type = message.getType();
     42        if (type == DatabaseStoreMessage.MESSAGE_TYPE) {
    4243            DatabaseStoreMessage dsm = (DatabaseStoreMessage)message;
    4344            // is it worth making sure the reply came in on the right tunnel?
     
    4647                return true;
    4748            }
    48         } else if (message instanceof DatabaseSearchReplyMessage) {
     49        } else if (type == DatabaseSearchReplyMessage.MESSAGE_TYPE) {
    4950            DatabaseSearchReplyMessage dsrm = (DatabaseSearchReplyMessage)message;
    5051            if (_search.getKey().equals(dsrm.getSearchKey())) {
  • router/java/src/net/i2p/router/networkdb/kademlia/SearchMessageSelector.java

    r5b1b4ac r95366c0  
    7070                       + ") [want dbStore or dbSearchReply from " + _peer
    7171                       + " for " + _state.getTarget() + "]");
    72         if (message instanceof DatabaseStoreMessage) {
     72        int type = message.getType();
     73        if (type == DatabaseStoreMessage.MESSAGE_TYPE) {
    7374            DatabaseStoreMessage msg = (DatabaseStoreMessage)message;
    7475            if (msg.getKey().equals(_state.getTarget())) {
     
    8485                return false;
    8586            }
    86         } else if (message instanceof DatabaseSearchReplyMessage) {
     87        } else if (type == DatabaseSearchReplyMessage.MESSAGE_TYPE) {
    8788            DatabaseSearchReplyMessage msg = (DatabaseSearchReplyMessage)message;
    8889            if (_peer.equals(msg.getFromHash())) {
  • router/java/src/net/i2p/router/networkdb/kademlia/SearchUpdateReplyFoundJob.java

    r5b1b4ac r95366c0  
    8080        }
    8181       
    82         if (message instanceof DatabaseStoreMessage) {
     82        int type = message.getType();
     83        if (type == DatabaseStoreMessage.MESSAGE_TYPE) {
    8384            long timeToReply = _state.dataFound(_peer);
    8485            DatabaseStoreMessage msg = (DatabaseStoreMessage)message;
     
    9899                getContext().profileManager().dbLookupReply(_peer, 0, 0, 1, 0, timeToReply);
    99100            }
    100         } else if (message instanceof DatabaseSearchReplyMessage) {
     101        } else if (type == DatabaseSearchReplyMessage.MESSAGE_TYPE) {
    101102            _job.replyFound((DatabaseSearchReplyMessage)message, _peer);
    102103        } else {
  • router/java/src/net/i2p/router/networkdb/kademlia/StoreMessageSelector.java

    r5b1b4ac r95366c0  
    4040
    4141    public boolean isMatch(I2NPMessage message) {
    42         if (_log.shouldLog(Log.DEBUG))
    43             _log.debug(_storeJobId + ": isMatch("+message.getClass().getName() + ") [want deliveryStatusMessage from "
    44                        + _peer + "]");
    45         if (message instanceof DeliveryStatusMessage) {
     42        if (_log.shouldDebug())
     43            _log.debug(_storeJobId + ": isMatch(" + message.getClass().getSimpleName() + ") [want DSM from "
     44                       + _peer + ']');
     45        if (message.getType() == DeliveryStatusMessage.MESSAGE_TYPE) {
    4646            DeliveryStatusMessage msg = (DeliveryStatusMessage)message;
    4747            if (msg.getMessageId() == _waitingForId) {
    48                 if (_log.shouldLog(Log.INFO))
     48                if (_log.shouldInfo())
    4949                    _log.info(_storeJobId + ": Found match for the key we're waiting for: " + _waitingForId);
    5050                _found = true;
    5151                return true;
    5252            } else {
    53                 if (_log.shouldLog(Log.DEBUG))
    54                     _log.debug(_storeJobId + ": DeliveryStatusMessage of a key we're not looking for");
     53                if (_log.shouldDebug())
     54                    _log.debug(_storeJobId + ": DeliveryStatusMessage of " + msg.getMessageId() +
     55                               " but waiting for " + _waitingForId);
    5556                return false;
    5657            }
    5758        } else {
    58             if (_log.shouldLog(Log.DEBUG))
    59                 _log.debug(_storeJobId + ": Not a DeliveryStatusMessage");
     59            //if (_log.shouldLog(Log.DEBUG))
     60            //    _log.debug(_storeJobId + ": Not a DeliveryStatusMessage");
    6061            return false;
    6162        }
Note: See TracChangeset for help on using the changeset viewer.