forked from I2P_Developers/i2p.i2p
NetDB: Minor performance improvement in selectors
log tweaks
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
2019-03-06 zzz
|
||||
* NetDB: Fix flood version check, add version check for RedDSA
|
||||
|
||||
2019-03-05 zzz
|
||||
* Data: Update Encrypted LS2 blinding and encryption
|
||||
|
||||
|
@ -18,10 +18,10 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 13;
|
||||
public final static long BUILD = 14;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
public final static String EXTRA = "-rc";
|
||||
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + FULL_VERSION);
|
||||
|
@ -36,7 +36,7 @@ class FloodOnlyLookupMatchJob extends JobImpl implements ReplyJob {
|
||||
public String getName() { return "NetDb flood search match"; }
|
||||
|
||||
public void setMessage(I2NPMessage message) {
|
||||
if (message instanceof DatabaseSearchReplyMessage) {
|
||||
if (message.getType() == DatabaseSearchReplyMessage.MESSAGE_TYPE) {
|
||||
// DSRM processing now in FloodOnlyLookupSelector instead of here,
|
||||
// a dsrm is only passed in when there are no more lookups remaining
|
||||
// so that all DSRM's are processed, not just the last one.
|
||||
|
@ -30,7 +30,8 @@ class FloodOnlyLookupSelector implements MessageSelector {
|
||||
|
||||
public boolean isMatch(I2NPMessage message) {
|
||||
if (message == null) return false;
|
||||
if (message instanceof DatabaseStoreMessage) {
|
||||
int type = message.getType();
|
||||
if (type == DatabaseStoreMessage.MESSAGE_TYPE) {
|
||||
DatabaseStoreMessage dsm = (DatabaseStoreMessage)message;
|
||||
// is it worth making sure the reply came in on the right tunnel?
|
||||
if (_search.getKey().equals(dsm.getKey())) {
|
||||
@ -38,7 +39,7 @@ class FloodOnlyLookupSelector implements MessageSelector {
|
||||
_matchFound = true;
|
||||
return true;
|
||||
}
|
||||
} else if (message instanceof DatabaseSearchReplyMessage) {
|
||||
} else if (type == DatabaseSearchReplyMessage.MESSAGE_TYPE) {
|
||||
DatabaseSearchReplyMessage dsrm = (DatabaseSearchReplyMessage)message;
|
||||
if (_search.getKey().equals(dsrm.getSearchKey())) {
|
||||
|
||||
|
@ -569,8 +569,8 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
|
||||
(getKBucketSetSize() < MIN_REMAINING_ROUTERS ||
|
||||
_context.router().getUptime() < DONT_FAIL_PERIOD ||
|
||||
_context.commSystem().countActivePeers() <= MIN_ACTIVE_PEERS)) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Not failing " + peer.toBase64() + " as we are just starting up or have problems");
|
||||
if (_log.shouldInfo())
|
||||
_log.info("Not failing " + peer.toBase64() + " as we are just starting up or have problems");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -255,10 +255,11 @@ class FloodfillVerifyStoreJob extends JobImpl {
|
||||
|
||||
public long getExpiration() { return _expiration; }
|
||||
public boolean isMatch(I2NPMessage message) {
|
||||
if (message instanceof DatabaseStoreMessage) {
|
||||
int type = message.getType();
|
||||
if (type == DatabaseStoreMessage.MESSAGE_TYPE) {
|
||||
DatabaseStoreMessage dsm = (DatabaseStoreMessage)message;
|
||||
return _key.equals(dsm.getKey());
|
||||
} else if (message instanceof DatabaseSearchReplyMessage) {
|
||||
} else if (type == DatabaseSearchReplyMessage.MESSAGE_TYPE) {
|
||||
DatabaseSearchReplyMessage dsrm = (DatabaseSearchReplyMessage)message;
|
||||
return _key.equals(dsrm.getSearchKey());
|
||||
}
|
||||
|
@ -38,14 +38,15 @@ class IterativeLookupSelector implements MessageSelector {
|
||||
*/
|
||||
public boolean isMatch(I2NPMessage message) {
|
||||
if (message == null) return false;
|
||||
if (message instanceof DatabaseStoreMessage) {
|
||||
int type = message.getType();
|
||||
if (type == DatabaseStoreMessage.MESSAGE_TYPE) {
|
||||
DatabaseStoreMessage dsm = (DatabaseStoreMessage)message;
|
||||
// is it worth making sure the reply came in on the right tunnel?
|
||||
if (_search.getKey().equals(dsm.getKey())) {
|
||||
_matchFound = true;
|
||||
return true;
|
||||
}
|
||||
} else if (message instanceof DatabaseSearchReplyMessage) {
|
||||
} else if (type == DatabaseSearchReplyMessage.MESSAGE_TYPE) {
|
||||
DatabaseSearchReplyMessage dsrm = (DatabaseSearchReplyMessage)message;
|
||||
if (_search.getKey().equals(dsrm.getSearchKey())) {
|
||||
// Got a netDb reply pointing us at other floodfills...
|
||||
|
@ -69,7 +69,8 @@ class SearchMessageSelector implements MessageSelector {
|
||||
_log.debug("[" + _id + "] isMatch("+message.getClass().getName()
|
||||
+ ") [want dbStore or dbSearchReply from " + _peer
|
||||
+ " for " + _state.getTarget() + "]");
|
||||
if (message instanceof DatabaseStoreMessage) {
|
||||
int type = message.getType();
|
||||
if (type == DatabaseStoreMessage.MESSAGE_TYPE) {
|
||||
DatabaseStoreMessage msg = (DatabaseStoreMessage)message;
|
||||
if (msg.getKey().equals(_state.getTarget())) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
@ -83,7 +84,7 @@ class SearchMessageSelector implements MessageSelector {
|
||||
_log.debug("[" + _id + "] DBStore of a key we're not looking for");
|
||||
return false;
|
||||
}
|
||||
} else if (message instanceof DatabaseSearchReplyMessage) {
|
||||
} else if (type == DatabaseSearchReplyMessage.MESSAGE_TYPE) {
|
||||
DatabaseSearchReplyMessage msg = (DatabaseSearchReplyMessage)message;
|
||||
if (_peer.equals(msg.getFromHash())) {
|
||||
if (msg.getSearchKey().equals(_state.getTarget())) {
|
||||
|
@ -79,7 +79,8 @@ class SearchUpdateReplyFoundJob extends JobImpl implements ReplyJob {
|
||||
_outTunnel.incrementVerifiedBytesTransferred(msgSize);
|
||||
}
|
||||
|
||||
if (message instanceof DatabaseStoreMessage) {
|
||||
int type = message.getType();
|
||||
if (type == DatabaseStoreMessage.MESSAGE_TYPE) {
|
||||
long timeToReply = _state.dataFound(_peer);
|
||||
DatabaseStoreMessage msg = (DatabaseStoreMessage)message;
|
||||
DatabaseEntry entry = msg.getEntry();
|
||||
@ -97,7 +98,7 @@ class SearchUpdateReplyFoundJob extends JobImpl implements ReplyJob {
|
||||
// blame the peer
|
||||
getContext().profileManager().dbLookupReply(_peer, 0, 0, 1, 0, timeToReply);
|
||||
}
|
||||
} else if (message instanceof DatabaseSearchReplyMessage) {
|
||||
} else if (type == DatabaseSearchReplyMessage.MESSAGE_TYPE) {
|
||||
_job.replyFound((DatabaseSearchReplyMessage)message, _peer);
|
||||
} else {
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
|
@ -39,24 +39,25 @@ class StoreMessageSelector implements MessageSelector {
|
||||
public long getExpiration() { return _expiration; }
|
||||
|
||||
public boolean isMatch(I2NPMessage message) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(_storeJobId + ": isMatch("+message.getClass().getName() + ") [want deliveryStatusMessage from "
|
||||
+ _peer + "]");
|
||||
if (message instanceof DeliveryStatusMessage) {
|
||||
if (_log.shouldDebug())
|
||||
_log.debug(_storeJobId + ": isMatch(" + message.getClass().getSimpleName() + ") [want DSM from "
|
||||
+ _peer + ']');
|
||||
if (message.getType() == DeliveryStatusMessage.MESSAGE_TYPE) {
|
||||
DeliveryStatusMessage msg = (DeliveryStatusMessage)message;
|
||||
if (msg.getMessageId() == _waitingForId) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
if (_log.shouldInfo())
|
||||
_log.info(_storeJobId + ": Found match for the key we're waiting for: " + _waitingForId);
|
||||
_found = true;
|
||||
return true;
|
||||
} else {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(_storeJobId + ": DeliveryStatusMessage of a key we're not looking for");
|
||||
if (_log.shouldDebug())
|
||||
_log.debug(_storeJobId + ": DeliveryStatusMessage of " + msg.getMessageId() +
|
||||
" but waiting for " + _waitingForId);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(_storeJobId + ": Not a DeliveryStatusMessage");
|
||||
//if (_log.shouldLog(Log.DEBUG))
|
||||
// _log.debug(_storeJobId + ": Not a DeliveryStatusMessage");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user