forked from I2P_Developers/i2p.i2p
* NetDB:
- Reduce min part tunnels for ffs to 35 - Use client tunnels for LS lookups from OCMOSJ (ticket #1166)
This commit is contained in:
13
history.txt
13
history.txt
@ -1,10 +1,18 @@
|
|||||||
|
2014-01-11 zzz
|
||||||
|
* NetDB:
|
||||||
|
- Reduce min part tunnels for ffs to 35
|
||||||
|
- Use client tunnels for LS lookups from OCMOSJ (ticket #1166)
|
||||||
|
|
||||||
2014-01-11 str4d
|
2014-01-11 str4d
|
||||||
* BOB: Pass through I2CP host/port (ticket #827)
|
* BOB: Pass through I2CP host/port (ticket #827)
|
||||||
|
|
||||||
2014-01-10 str4d
|
2014-01-10 str4d
|
||||||
* BOB: Implement ClientApp interface (ticket #347)
|
* BOB: Implement ClientApp interface (ticket #347)
|
||||||
|
|
||||||
2014-01-09
|
2014-01-09 zzz
|
||||||
|
* Kademila: Fix NPE in remove()
|
||||||
|
|
||||||
|
2014-01-09 kytv
|
||||||
* Translations
|
* Translations
|
||||||
- Updates to French, German, Romanian, and Russian
|
- Updates to French, German, Romanian, and Russian
|
||||||
- New Brazilian Portuguese translation
|
- New Brazilian Portuguese translation
|
||||||
@ -17,6 +25,9 @@
|
|||||||
- UTF-8 support from wockenfuss (ticket #508)
|
- UTF-8 support from wockenfuss (ticket #508)
|
||||||
* Console: Fixed overlapping text issue in midnight theme
|
* Console: Fixed overlapping text issue in midnight theme
|
||||||
|
|
||||||
|
2014-01-07 zzz
|
||||||
|
* Streaming: Fix StandardServerSocket.close() and isClosed()
|
||||||
|
|
||||||
2014-01-04 zzz
|
2014-01-04 zzz
|
||||||
* Peermanager: Disable small same-country bonus
|
* Peermanager: Disable small same-country bonus
|
||||||
* Tunnels: Change client default to 3 hops in router;
|
* Tunnels: Change client default to 3 hops in router;
|
||||||
|
@ -40,6 +40,14 @@ public abstract class NetworkDatabaseFacade implements Service {
|
|||||||
*/
|
*/
|
||||||
public abstract DatabaseEntry lookupLocally(Hash key);
|
public abstract DatabaseEntry lookupLocally(Hash key);
|
||||||
public abstract void lookupLeaseSet(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs);
|
public abstract void lookupLeaseSet(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup using the client's tunnels
|
||||||
|
* @param fromLocalDest use these tunnels for the lookup, or null for exploratory
|
||||||
|
* @since 0.9.10
|
||||||
|
*/
|
||||||
|
public abstract void lookupLeaseSet(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, Hash fromLocalDest);
|
||||||
|
|
||||||
public abstract LeaseSet lookupLeaseSetLocally(Hash key);
|
public abstract LeaseSet lookupLeaseSetLocally(Hash key);
|
||||||
public abstract void lookupRouterInfo(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs);
|
public abstract void lookupRouterInfo(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs);
|
||||||
public abstract RouterInfo lookupRouterInfoLocally(Hash key);
|
public abstract RouterInfo lookupRouterInfoLocally(Hash key);
|
||||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 7;
|
public final static long BUILD = 8;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
@ -40,6 +40,7 @@ public class DummyNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
|||||||
|
|
||||||
public DatabaseEntry lookupLocally(Hash key) { return null; }
|
public DatabaseEntry lookupLocally(Hash key) { return null; }
|
||||||
public void lookupLeaseSet(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs) {}
|
public void lookupLeaseSet(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs) {}
|
||||||
|
public void lookupLeaseSet(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, Hash fromLocalDest) {}
|
||||||
public LeaseSet lookupLeaseSetLocally(Hash key) { return null; }
|
public LeaseSet lookupLeaseSetLocally(Hash key) { return null; }
|
||||||
public void lookupRouterInfo(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs) {
|
public void lookupRouterInfo(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs) {
|
||||||
RouterInfo info = lookupRouterInfoLocally(key);
|
RouterInfo info = lookupRouterInfoLocally(key);
|
||||||
|
@ -219,7 +219,7 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
|||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug(getJobId() + ": Send outbound client message - sending off leaseSet lookup job for " + _toString);
|
_log.debug(getJobId() + ": Send outbound client message - sending off leaseSet lookup job for " + _toString);
|
||||||
LookupLeaseSetFailedJob failed = new LookupLeaseSetFailedJob(getContext());
|
LookupLeaseSetFailedJob failed = new LookupLeaseSetFailedJob(getContext());
|
||||||
getContext().netDb().lookupLeaseSet(key, success, failed, timeoutMs);
|
getContext().netDb().lookupLeaseSet(key, success, failed, timeoutMs, _from.calculateHash());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ class FloodfillMonitorJob extends JobImpl {
|
|||||||
// Only if we're pretty well integrated...
|
// Only if we're pretty well integrated...
|
||||||
happy = happy && _facade.getKnownRouters() >= 200;
|
happy = happy && _facade.getKnownRouters() >= 200;
|
||||||
happy = happy && getContext().commSystem().countActivePeers() >= 50;
|
happy = happy && getContext().commSystem().countActivePeers() >= 50;
|
||||||
happy = happy && getContext().tunnelManager().getParticipatingCount() >= 50;
|
happy = happy && getContext().tunnelManager().getParticipatingCount() >= 35;
|
||||||
happy = happy && Math.abs(getContext().clock().getOffset()) < 10*1000;
|
happy = happy && Math.abs(getContext().clock().getOffset()) < 10*1000;
|
||||||
// We need an address and no introducers
|
// We need an address and no introducers
|
||||||
if (happy) {
|
if (happy) {
|
||||||
|
@ -299,6 +299,8 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Lookup using exploratory tunnels
|
||||||
|
*
|
||||||
* Begin a kademlia style search for the key specified, which can take up to timeoutMs and
|
* Begin a kademlia style search for the key specified, which can take up to timeoutMs and
|
||||||
* will fire the appropriate jobs on success or timeout (or if the kademlia search completes
|
* will fire the appropriate jobs on success or timeout (or if the kademlia search completes
|
||||||
* without any match)
|
* without any match)
|
||||||
@ -307,6 +309,17 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
SearchJob search(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, boolean isLease) {
|
SearchJob search(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, boolean isLease) {
|
||||||
|
return search(key, onFindJob, onFailedLookupJob, timeoutMs, isLease, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup using the client's tunnels
|
||||||
|
* @param fromLocalDest use these tunnels for the lookup, or null for exploratory
|
||||||
|
* @return null always
|
||||||
|
* @since 0.9.10
|
||||||
|
*/
|
||||||
|
SearchJob search(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, boolean isLease,
|
||||||
|
Hash fromLocalDest) {
|
||||||
//if (true) return super.search(key, onFindJob, onFailedLookupJob, timeoutMs, isLease);
|
//if (true) return super.search(key, onFindJob, onFailedLookupJob, timeoutMs, isLease);
|
||||||
if (key == null) throw new IllegalArgumentException("searchin for nothin, eh?");
|
if (key == null) throw new IllegalArgumentException("searchin for nothin, eh?");
|
||||||
boolean isNew = false;
|
boolean isNew = false;
|
||||||
@ -316,7 +329,8 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
|
|||||||
if (searchJob == null) {
|
if (searchJob == null) {
|
||||||
//if (SearchJob.onlyQueryFloodfillPeers(_context)) {
|
//if (SearchJob.onlyQueryFloodfillPeers(_context)) {
|
||||||
//searchJob = new FloodOnlySearchJob(_context, this, key, onFindJob, onFailedLookupJob, (int)timeoutMs, isLease);
|
//searchJob = new FloodOnlySearchJob(_context, this, key, onFindJob, onFailedLookupJob, (int)timeoutMs, isLease);
|
||||||
searchJob = new IterativeSearchJob(_context, this, key, onFindJob, onFailedLookupJob, (int)timeoutMs, isLease);
|
searchJob = new IterativeSearchJob(_context, this, key, onFindJob, onFailedLookupJob, (int)timeoutMs,
|
||||||
|
isLease, fromLocalDest);
|
||||||
//} else {
|
//} else {
|
||||||
// searchJob = new FloodSearchJob(_context, this, key, onFindJob, onFailedLookupJob, (int)timeoutMs, isLease);
|
// searchJob = new FloodSearchJob(_context, this, key, onFindJob, onFailedLookupJob, (int)timeoutMs, isLease);
|
||||||
//}
|
//}
|
||||||
|
@ -25,6 +25,7 @@ import net.i2p.router.OutNetMessage;
|
|||||||
import net.i2p.router.ReplyJob;
|
import net.i2p.router.ReplyJob;
|
||||||
import net.i2p.router.RouterContext;
|
import net.i2p.router.RouterContext;
|
||||||
import net.i2p.router.TunnelInfo;
|
import net.i2p.router.TunnelInfo;
|
||||||
|
import net.i2p.router.TunnelManagerFacade;
|
||||||
import net.i2p.router.util.RandomIterator;
|
import net.i2p.router.util.RandomIterator;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
|
||||||
@ -63,6 +64,7 @@ class IterativeSearchJob extends FloodSearchJob {
|
|||||||
private final Hash _rkey;
|
private final Hash _rkey;
|
||||||
/** this is a marker to register with the MessageRegistry, it is never sent */
|
/** this is a marker to register with the MessageRegistry, it is never sent */
|
||||||
private OutNetMessage _out;
|
private OutNetMessage _out;
|
||||||
|
private final Hash _fromLocalDest;
|
||||||
/** testing */
|
/** testing */
|
||||||
private static Hash _alwaysQueryHash;
|
private static Hash _alwaysQueryHash;
|
||||||
|
|
||||||
@ -89,7 +91,21 @@ class IterativeSearchJob extends FloodSearchJob {
|
|||||||
/** testing */
|
/** testing */
|
||||||
private static final String PROP_ENCRYPT_RI = "router.encryptRouterLookups";
|
private static final String PROP_ENCRYPT_RI = "router.encryptRouterLookups";
|
||||||
|
|
||||||
public IterativeSearchJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade, Hash key, Job onFind, Job onFailed, int timeoutMs, boolean isLease) {
|
/**
|
||||||
|
* Lookup using exploratory tunnels
|
||||||
|
*/
|
||||||
|
public IterativeSearchJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade, Hash key,
|
||||||
|
Job onFind, Job onFailed, int timeoutMs, boolean isLease) {
|
||||||
|
this(ctx, facade, key, onFind, onFailed, timeoutMs, isLease, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup using the client's tunnels
|
||||||
|
* @param fromLocalDest use these tunnels for the lookup, or null for exploratory
|
||||||
|
* @since 0.9.10
|
||||||
|
*/
|
||||||
|
public IterativeSearchJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade, Hash key,
|
||||||
|
Job onFind, Job onFailed, int timeoutMs, boolean isLease, Hash fromLocalDest) {
|
||||||
super(ctx, facade, key, onFind, onFailed, timeoutMs, isLease);
|
super(ctx, facade, key, onFind, onFailed, timeoutMs, isLease);
|
||||||
// these override the settings in super
|
// these override the settings in super
|
||||||
_timeoutMs = Math.min(timeoutMs, MAX_SEARCH_TIME);
|
_timeoutMs = Math.min(timeoutMs, MAX_SEARCH_TIME);
|
||||||
@ -99,6 +115,7 @@ class IterativeSearchJob extends FloodSearchJob {
|
|||||||
_unheardFrom = new HashSet<Hash>(CONCURRENT_SEARCHES);
|
_unheardFrom = new HashSet<Hash>(CONCURRENT_SEARCHES);
|
||||||
_failedPeers = new HashSet<Hash>(TOTAL_SEARCH_LIMIT);
|
_failedPeers = new HashSet<Hash>(TOTAL_SEARCH_LIMIT);
|
||||||
_sentTime = new ConcurrentHashMap<Hash, Long>(TOTAL_SEARCH_LIMIT);
|
_sentTime = new ConcurrentHashMap<Hash, Long>(TOTAL_SEARCH_LIMIT);
|
||||||
|
_fromLocalDest = fromLocalDest;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -232,8 +249,23 @@ class IterativeSearchJob extends FloodSearchJob {
|
|||||||
*/
|
*/
|
||||||
private void sendQuery(Hash peer) {
|
private void sendQuery(Hash peer) {
|
||||||
DatabaseLookupMessage dlm = new DatabaseLookupMessage(getContext(), true);
|
DatabaseLookupMessage dlm = new DatabaseLookupMessage(getContext(), true);
|
||||||
TunnelInfo replyTunnel = getContext().tunnelManager().selectInboundExploratoryTunnel(peer);
|
TunnelManagerFacade tm = getContext().tunnelManager();
|
||||||
TunnelInfo outTunnel = getContext().tunnelManager().selectOutboundExploratoryTunnel(peer);
|
TunnelInfo outTunnel;
|
||||||
|
TunnelInfo replyTunnel;
|
||||||
|
boolean isClientReplyTunnel;
|
||||||
|
if (_fromLocalDest != null) {
|
||||||
|
outTunnel = tm.selectOutboundTunnel(_fromLocalDest, peer);
|
||||||
|
if (outTunnel == null)
|
||||||
|
outTunnel = tm.selectOutboundExploratoryTunnel(peer);
|
||||||
|
replyTunnel = tm.selectInboundTunnel(_fromLocalDest, peer);
|
||||||
|
isClientReplyTunnel = replyTunnel != null;
|
||||||
|
if (!isClientReplyTunnel)
|
||||||
|
replyTunnel = tm.selectInboundExploratoryTunnel(peer);
|
||||||
|
} else {
|
||||||
|
outTunnel = tm.selectOutboundExploratoryTunnel(peer);
|
||||||
|
replyTunnel = tm.selectInboundExploratoryTunnel(peer);
|
||||||
|
isClientReplyTunnel = false;
|
||||||
|
}
|
||||||
if ( (replyTunnel == null) || (outTunnel == null) ) {
|
if ( (replyTunnel == null) || (outTunnel == null) ) {
|
||||||
failed();
|
failed();
|
||||||
return;
|
return;
|
||||||
@ -260,7 +292,8 @@ class IterativeSearchJob extends FloodSearchJob {
|
|||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
tries = _unheardFrom.size() + _failedPeers.size();
|
tries = _unheardFrom.size() + _failedPeers.size();
|
||||||
}
|
}
|
||||||
_log.info(getJobId() + ": ISJ try " + tries + " for " + _key + " to " + peer);
|
_log.info(getJobId() + ": ISJ try " + tries + " for " + _key + " to " + peer +
|
||||||
|
" reply via client tunnel? " + isClientReplyTunnel);
|
||||||
}
|
}
|
||||||
long now = getContext().clock().now();
|
long now = getContext().clock().now();
|
||||||
_sentTime.put(peer, Long.valueOf(now));
|
_sentTime.put(peer, Long.valueOf(now));
|
||||||
@ -273,7 +306,11 @@ class IterativeSearchJob extends FloodSearchJob {
|
|||||||
if (ri != null) {
|
if (ri != null) {
|
||||||
// request encrypted reply
|
// request encrypted reply
|
||||||
if (DatabaseLookupMessage.supportsEncryptedReplies(ri)) {
|
if (DatabaseLookupMessage.supportsEncryptedReplies(ri)) {
|
||||||
MessageWrapper.OneTimeSession sess = MessageWrapper.generateSession(getContext());
|
MessageWrapper.OneTimeSession sess;
|
||||||
|
if (isClientReplyTunnel)
|
||||||
|
sess = MessageWrapper.generateSession(getContext(), _fromLocalDest);
|
||||||
|
else
|
||||||
|
sess = MessageWrapper.generateSession(getContext());
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
_log.info(getJobId() + ": Requesting encrypted reply from " + peer + ' ' + sess.key + ' ' + sess.tag);
|
_log.info(getJobId() + ": Requesting encrypted reply from " + peer + ' ' + sess.key + ' ' + sess.tag);
|
||||||
dlm.setReplySession(sess.key, sess.tag);
|
dlm.setReplySession(sess.key, sess.tag);
|
||||||
|
@ -479,7 +479,20 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
|||||||
return _ds.get(key);
|
return _ds.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup using exploratory tunnels
|
||||||
|
*/
|
||||||
public void lookupLeaseSet(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs) {
|
public void lookupLeaseSet(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs) {
|
||||||
|
lookupLeaseSet(key, onFindJob, onFailedLookupJob, timeoutMs, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup using the client's tunnels
|
||||||
|
* @param fromLocalDest use these tunnels for the lookup, or null for exploratory
|
||||||
|
* @since 0.9.10
|
||||||
|
*/
|
||||||
|
public void lookupLeaseSet(Hash key, Job onFindJob, Job onFailedLookupJob,
|
||||||
|
long timeoutMs, Hash fromLocalDest) {
|
||||||
if (!_initialized) return;
|
if (!_initialized) return;
|
||||||
LeaseSet ls = lookupLeaseSetLocally(key);
|
LeaseSet ls = lookupLeaseSetLocally(key);
|
||||||
if (ls != null) {
|
if (ls != null) {
|
||||||
@ -490,7 +503,7 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
|||||||
} else {
|
} else {
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("leaseSet not found locally, running search");
|
_log.debug("leaseSet not found locally, running search");
|
||||||
search(key, onFindJob, onFailedLookupJob, timeoutMs, true);
|
search(key, onFindJob, onFailedLookupJob, timeoutMs, true, fromLocalDest);
|
||||||
}
|
}
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("after lookupLeaseSet");
|
_log.debug("after lookupLeaseSet");
|
||||||
@ -1020,6 +1033,16 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
|||||||
return searchJob;
|
return searchJob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unused - see FNDF
|
||||||
|
* @throws UnsupportedOperationException always
|
||||||
|
* @since 0.9.10
|
||||||
|
*/
|
||||||
|
SearchJob search(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, boolean isLease,
|
||||||
|
Hash fromLocalDest) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
/** public for NetDbRenderer in routerconsole */
|
/** public for NetDbRenderer in routerconsole */
|
||||||
@Override
|
@Override
|
||||||
public Set<LeaseSet> getLeases() {
|
public Set<LeaseSet> getLeases() {
|
||||||
|
Reference in New Issue
Block a user