mirror of
https://github.com/i2p/i2p.i2p.git
synced 2026-04-27 21:35:18 +00:00
I2p.i2p.2.4.0 undo breaking api change
This commit is contained in:
@@ -269,7 +269,7 @@ public class Banlist {
|
||||
|
||||
if (transport == null) {
|
||||
// we hate the peer on *any* transport
|
||||
_context.netDb().fail(peer);
|
||||
_context.netDbSegmentor().fail(peer);
|
||||
_context.tunnelManager().fail(peer);
|
||||
}
|
||||
//_context.tunnelManager().peerFailed(peer);
|
||||
|
||||
@@ -942,7 +942,7 @@ public class Blocklist {
|
||||
* Will not contain duplicates.
|
||||
*/
|
||||
private List<byte[]> getAddresses(Hash peer) {
|
||||
RouterInfo pinfo = _context.netDb().lookupRouterInfoLocally(peer, null);
|
||||
RouterInfo pinfo = _context.netDbSegmentor().lookupRouterInfoLocally(peer, null);
|
||||
if (pinfo == null)
|
||||
return Collections.emptyList();
|
||||
return getAddresses(pinfo);
|
||||
|
||||
@@ -140,11 +140,11 @@ public class MultiRouter {
|
||||
|
||||
HashSet<RouterInfo> riSet = new HashSet<RouterInfo>();
|
||||
for(Router r : _routers) {
|
||||
riSet.addAll(r.getContext().netDb().getRouters());
|
||||
riSet.addAll(r.getContext().netDbSegmentor().getRouters());
|
||||
}
|
||||
for(Router r : _routers) {
|
||||
for(RouterInfo ri : riSet){
|
||||
r.getContext().netDb().publish(ri);
|
||||
r.getContext().netDbSegmentor().publish(ri);
|
||||
}
|
||||
}
|
||||
_out.println(riSet.size() + " RouterInfos were reseeded");
|
||||
|
||||
@@ -1188,7 +1188,7 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
// rv.append(CAPABILITY_BW256);
|
||||
|
||||
// if prop set to true, don't tell people we are ff even if we are
|
||||
if (_context.netDb().floodfillEnabled() &&
|
||||
if (_context.netDbSegmentor().floodfillEnabled() &&
|
||||
!_context.getBooleanProperty("router.hideFloodfillParticipant"))
|
||||
rv.append(FloodfillNetworkDatabaseFacade.CAPABILITY_FLOODFILL);
|
||||
|
||||
@@ -1603,7 +1603,7 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
try { _context.jobQueue().shutdown(); } catch (Throwable t) { _log.error("Error shutting down the job queue", t); }
|
||||
try { _context.tunnelManager().shutdown(); } catch (Throwable t) { _log.error("Error shutting down the tunnel manager", t); }
|
||||
try { _context.tunnelDispatcher().shutdown(); } catch (Throwable t) { _log.error("Error shutting down the tunnel dispatcher", t); }
|
||||
try { _context.netDb().shutdown(); } catch (Throwable t) { _log.error("Error shutting down the networkDb", t); }
|
||||
try { _context.netDbSegmentor().shutdown(); } catch (Throwable t) { _log.error("Error shutting down the networkDb", t); }
|
||||
try { _context.commSystem().shutdown(); } catch (Throwable t) { _log.error("Error shutting down the comm system", t); }
|
||||
try { _context.bandwidthLimiter().shutdown(); } catch (Throwable t) { _log.error("Error shutting down the comm system", t); }
|
||||
try { _context.peerManager().shutdown(); } catch (Throwable t) { _log.error("Error shutting down the peer manager", t); }
|
||||
|
||||
@@ -372,7 +372,8 @@ public class RouterContext extends I2PAppContext {
|
||||
/**
|
||||
* Our db cache
|
||||
*/
|
||||
public SegmentedNetworkDatabaseFacade netDb() { return _netDb; }
|
||||
public SegmentedNetworkDatabaseFacade netDbSegmentor() { return _netDb; }
|
||||
public FloodfillNetworkDatabaseFacade netDb() { return _netDb.mainNetDB(); }
|
||||
public FloodfillNetworkDatabaseFacade mainNetDb() { return _netDb.mainNetDB(); }
|
||||
public FloodfillNetworkDatabaseFacade exploratoryNetDb() { return _netDb.exploratoryNetDB(); }
|
||||
public FloodfillNetworkDatabaseFacade clientNetDb(String id) { return _netDb.clientNetDB(id); }
|
||||
|
||||
@@ -211,18 +211,18 @@ class ClientConnectionRunner {
|
||||
_manager.unregisterEncryptedDestination(this, _encryptedLSHash);
|
||||
_manager.unregisterConnection(this);
|
||||
// netdb may be null in unit tests
|
||||
if (_context.netDb() != null) {
|
||||
if (_context.netDbSegmentor() != null) {
|
||||
// Note that if the client sent us a destroy message,
|
||||
// removeSession() was called just before this, and
|
||||
// _sessions will be empty.
|
||||
for (SessionParams sp : _sessions.values()) {
|
||||
LeaseSet ls = sp.currentLeaseSet;
|
||||
if (ls != null)
|
||||
_context.netDb().unpublish(ls);
|
||||
_context.netDbSegmentor().unpublish(ls);
|
||||
// unpublish encrypted LS also
|
||||
ls = sp.currentEncryptedLeaseSet;
|
||||
if (ls != null)
|
||||
_context.netDb().unpublish(ls);
|
||||
_context.netDbSegmentor().unpublish(ls);
|
||||
if (!sp.isPrimary)
|
||||
_context.tunnelManager().removeAlias(sp.dest);
|
||||
}
|
||||
@@ -458,11 +458,11 @@ class ClientConnectionRunner {
|
||||
_manager.unregisterSession(id, sp.dest);
|
||||
LeaseSet ls = sp.currentLeaseSet;
|
||||
if (ls != null)
|
||||
_context.netDb().unpublish(ls);
|
||||
_context.netDbSegmentor().unpublish(ls);
|
||||
// unpublish encrypted LS also
|
||||
ls = sp.currentEncryptedLeaseSet;
|
||||
if (ls != null)
|
||||
_context.netDb().unpublish(ls);
|
||||
_context.netDbSegmentor().unpublish(ls);
|
||||
isPrimary = sp.isPrimary;
|
||||
if (isPrimary)
|
||||
_context.tunnelManager().removeTunnels(sp.dest);
|
||||
@@ -483,11 +483,11 @@ class ClientConnectionRunner {
|
||||
_manager.unregisterSession(sp.sessionId, sp.dest);
|
||||
LeaseSet ls = sp.currentLeaseSet;
|
||||
if (ls != null)
|
||||
_context.netDb().unpublish(ls);
|
||||
_context.netDbSegmentor().unpublish(ls);
|
||||
// unpublish encrypted LS also
|
||||
ls = sp.currentEncryptedLeaseSet;
|
||||
if (ls != null)
|
||||
_context.netDb().unpublish(ls);
|
||||
_context.netDbSegmentor().unpublish(ls);
|
||||
_context.tunnelManager().removeAlias(sp.dest);
|
||||
synchronized(this) {
|
||||
if (sp.rerequestTimer != null)
|
||||
|
||||
@@ -711,13 +711,13 @@ class ClientMessageEventListener implements I2CPMessageReader.I2CPMessageEventLi
|
||||
}
|
||||
if (_log.shouldDebug())
|
||||
_log.debug("Publishing: " + ls);
|
||||
_context.netDb().publish(ls, _runner.getDestHash().toBase32());
|
||||
_context.netDbSegmentor().publish(ls, _runner.getDestHash().toBase32());
|
||||
if (type == DatabaseEntry.KEY_TYPE_ENCRYPTED_LS2) {
|
||||
// store the decrypted ls also
|
||||
EncryptedLeaseSet encls = (EncryptedLeaseSet) ls;
|
||||
if (_log.shouldDebug())
|
||||
_log.debug("Storing decrypted: " + encls.getDecryptedLeaseSet());
|
||||
_context.netDb().store(dest.getHash(), encls.getDecryptedLeaseSet());
|
||||
_context.netDbSegmentor().store(dest.getHash(), encls.getDecryptedLeaseSet());
|
||||
}
|
||||
} catch (IllegalArgumentException iae) {
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
@@ -861,9 +861,9 @@ class ClientMessageEventListener implements I2CPMessageReader.I2CPMessageEventLi
|
||||
_log.warn("Unsupported BlindingInfo type: " + message);
|
||||
return;
|
||||
}
|
||||
BlindData obd = _context.netDb().getBlindData(spk);
|
||||
BlindData obd = _context.netDbSegmentor().getBlindData(spk);
|
||||
if (obd == null) {
|
||||
_context.netDb().setBlindData(bd, _runner.getDestHash().toBase32());
|
||||
_context.netDbSegmentor().setBlindData(bd, _runner.getDestHash().toBase32());
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("New: " + bd);
|
||||
} else {
|
||||
@@ -884,7 +884,7 @@ class ClientMessageEventListener implements I2CPMessageReader.I2CPMessageEventLi
|
||||
return;
|
||||
}
|
||||
}
|
||||
_context.netDb().setBlindData(bd, _runner.getDestHash().toBase32());
|
||||
_context.netDbSegmentor().setBlindData(bd, _runner.getDestHash().toBase32());
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Updated: " + bd);
|
||||
} else {
|
||||
@@ -893,7 +893,7 @@ class ClientMessageEventListener implements I2CPMessageReader.I2CPMessageEventLi
|
||||
if (nexp > oexp) {
|
||||
obd.setExpiration(nexp);
|
||||
// to force save at shutdown
|
||||
_context.netDb().setBlindData(obd, _runner.getDestHash().toBase32());
|
||||
_context.netDbSegmentor().setBlindData(obd, _runner.getDestHash().toBase32());
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Updated expiration: " + obd);
|
||||
} else {
|
||||
|
||||
@@ -91,7 +91,7 @@ class LookupDestJob extends JobImpl {
|
||||
try {
|
||||
bd = Blinding.decode(context, b);
|
||||
SigningPublicKey spk = bd.getUnblindedPubKey();
|
||||
BlindData bd2 = getContext().netDb().getBlindData(spk);
|
||||
BlindData bd2 = getContext().netDbSegmentor().getBlindData(spk);
|
||||
if (bd2 != null) {
|
||||
// BlindData from database may have privkey or secret
|
||||
// check if we need it but don't have it
|
||||
@@ -110,7 +110,7 @@ class LookupDestJob extends JobImpl {
|
||||
long exp = now + ((bd.getAuthRequired() || bd.getSecretRequired()) ? 365*24*60*60*1000L
|
||||
: 90*24*68*60*1000L);
|
||||
bd.setExpiration(exp);
|
||||
getContext().netDb().setBlindData(bd, toBase32());
|
||||
getContext().netDbSegmentor().setBlindData(bd, toBase32());
|
||||
}
|
||||
h = bd.getBlindedHash();
|
||||
if (_log.shouldDebug())
|
||||
@@ -185,7 +185,7 @@ class LookupDestJob extends JobImpl {
|
||||
if (timeout > 1500)
|
||||
timeout -= 500;
|
||||
// TODO tell router this is an encrypted lookup, skip 38 or earlier ffs?
|
||||
getContext().netDb().lookupDestination(_hash, done, timeout, _fromLocalDest, toBase32());
|
||||
getContext().netDbSegmentor().lookupDestination(_hash, done, timeout, _fromLocalDest, toBase32());
|
||||
} else {
|
||||
// blinding decode fail
|
||||
returnFail(HostReplyMessage.RESULT_DECRYPTION_FAILURE);
|
||||
@@ -204,10 +204,10 @@ class LookupDestJob extends JobImpl {
|
||||
}
|
||||
public String getName() { return "LeaseSet Lookup Reply to Client"; }
|
||||
public void runJob() {
|
||||
Destination dest = getContext().netDb().lookupDestinationLocally(_hash, toBase32());
|
||||
Destination dest = getContext().netDbSegmentor().lookupDestinationLocally(_hash, toBase32());
|
||||
if (dest == null && _blindData != null) {
|
||||
// TODO store and lookup original hash instead
|
||||
LeaseSet ls = getContext().netDb().lookupLeaseSetLocally(_hash, toBase32());
|
||||
LeaseSet ls = getContext().netDbSegmentor().lookupLeaseSetLocally(_hash, toBase32());
|
||||
if (ls != null && ls.getType() == DatabaseEntry.KEY_TYPE_ENCRYPTED_LS2) {
|
||||
// already decrypted
|
||||
EncryptedLeaseSet encls = (EncryptedLeaseSet) ls;
|
||||
|
||||
@@ -209,7 +209,7 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
_hashPair = new OutboundCache.HashPair(_from.calculateHash(), toHash);
|
||||
_toString = toHash.toBase32();
|
||||
// we look up here rather than runJob() so we may adjust the timeout
|
||||
_leaseSet = ctx.netDb().lookupLeaseSetLocally(toHash, _from.calculateHash().toBase32());
|
||||
_leaseSet = ctx.netDbSegmentor().lookupLeaseSetLocally(toHash, _from.calculateHash().toBase32());
|
||||
|
||||
// use expiration requested by client if available, otherwise session config,
|
||||
// otherwise router config, otherwise default
|
||||
@@ -307,7 +307,7 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
if (_log.shouldInfo())
|
||||
_log.info(getJobId() + ": RAP LS, firing search: " + _leaseSet.getHash().toBase32());
|
||||
LookupLeaseSetFailedJob failed = new LookupLeaseSetFailedJob(getContext());
|
||||
getContext().netDb().lookupLeaseSetRemotely(_leaseSet.getHash(), success, failed,
|
||||
getContext().netDbSegmentor().lookupLeaseSetRemotely(_leaseSet.getHash(), success, failed,
|
||||
LS_LOOKUP_TIMEOUT, _from.calculateHash(), _from.calculateHash().toBase32());
|
||||
} else {
|
||||
dieFatal(MessageStatusMessage.STATUS_SEND_FAILURE_NO_LEASESET);
|
||||
@@ -330,7 +330,7 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
long exp = now - _leaseSet.getLatestLeaseDate();
|
||||
_log.info(getJobId() + ": leaseSet expired " + DataHelper.formatDuration(exp) + " ago, firing search: " + _leaseSet.getHash().toBase32());
|
||||
}
|
||||
getContext().netDb().lookupLeaseSetRemotely(_leaseSet.getHash(), _from.calculateHash(), _from.calculateHash().toBase32());
|
||||
getContext().netDbSegmentor().lookupLeaseSetRemotely(_leaseSet.getHash(), _from.calculateHash(), _from.calculateHash().toBase32());
|
||||
}
|
||||
}
|
||||
success.runJob();
|
||||
@@ -340,7 +340,7 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
_log.debug(getJobId() + ": Send outbound client message - sending off leaseSet lookup job for " + _toString + " from client " + _from.calculateHash().toBase32());
|
||||
LookupLeaseSetFailedJob failed = new LookupLeaseSetFailedJob(getContext());
|
||||
Hash key = _to.calculateHash();
|
||||
getContext().netDb().lookupLeaseSet(key, success, failed, LS_LOOKUP_TIMEOUT, _from.calculateHash(), _from.calculateHash().toBase32());
|
||||
getContext().netDbSegmentor().lookupLeaseSet(key, success, failed, LS_LOOKUP_TIMEOUT, _from.calculateHash(), _from.calculateHash().toBase32());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
* @return lease set or null if we should not send the lease set
|
||||
*/
|
||||
private LeaseSet getReplyLeaseSet(boolean force) {
|
||||
LeaseSet newLS = getContext().netDb().lookupLeaseSetLocally(_from.calculateHash(), _from.calculateHash().toBase32());
|
||||
LeaseSet newLS = getContext().netDbSegmentor().lookupLeaseSetLocally(_from.calculateHash(), _from.calculateHash().toBase32());
|
||||
if (newLS == null)
|
||||
return null; // punt
|
||||
|
||||
@@ -423,7 +423,7 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
private int getNextLease() {
|
||||
// set in runJob if found locally
|
||||
if (_leaseSet == null || !_leaseSet.getReceivedAsReply()) {
|
||||
_leaseSet = getContext().netDb().lookupLeaseSetLocally(_to.calculateHash(), _from.calculateHash().toBase32());
|
||||
_leaseSet = getContext().netDbSegmentor().lookupLeaseSetLocally(_to.calculateHash(), _from.calculateHash().toBase32());
|
||||
if (_leaseSet == null) {
|
||||
// shouldn't happen
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
@@ -550,7 +550,7 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
*** unfortunately the "U" is rarely seen.
|
||||
if (!getContext().commSystem().wasUnreachable(l.getGateway())) {
|
||||
***/
|
||||
RouterInfo ri = getContext().netDb().lookupRouterInfoLocally(l.getGateway(), null);
|
||||
RouterInfo ri = getContext().netDbSegmentor().lookupRouterInfoLocally(l.getGateway(), null);
|
||||
if (ri == null || ri.getCapabilities().indexOf(Router.CAPABILITY_UNREACHABLE) < 0) {
|
||||
_lease = l;
|
||||
break;
|
||||
@@ -587,7 +587,7 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
|
||||
|
||||
int cause;
|
||||
if (getContext().netDb().isNegativeCachedForever(_to.calculateHash(), _from.calculateHash().toBase32())) {
|
||||
if (getContext().netDbSegmentor().isNegativeCachedForever(_to.calculateHash(), _from.calculateHash().toBase32())) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Unable to send to " + _toString + " because the sig type is unsupported");
|
||||
cause = MessageStatusMessage.STATUS_SEND_FAILURE_UNSUPPORTED_ENCRYPTION;
|
||||
|
||||
@@ -76,7 +76,7 @@ public class PublishLocalRouterInfoJob extends JobImpl {
|
||||
requeue(100);
|
||||
return;
|
||||
}
|
||||
long last = getContext().netDb().getLastRouterInfoPublishTime();
|
||||
long last = getContext().netDbSegmentor().getLastRouterInfoPublishTime();
|
||||
long now = getContext().clock().now();
|
||||
if (last + MIN_PUBLISH_DELAY > now) {
|
||||
long delay = getDelay();
|
||||
@@ -141,7 +141,7 @@ public class PublishLocalRouterInfoJob extends JobImpl {
|
||||
+ new Date(ri.getPublished()));
|
||||
try {
|
||||
// This won't really publish until the netdb is initialized.
|
||||
getContext().netDb().publish(ri);
|
||||
getContext().netDbSegmentor().publish(ri);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
_log.log(Log.CRIT, "Error publishing our identity - corrupt? Restart required", iae);
|
||||
getContext().router().rebuildNewIdentity();
|
||||
|
||||
@@ -251,7 +251,7 @@ abstract class FloodSearchJob extends JobImpl {
|
||||
_search = job;
|
||||
}
|
||||
public void runJob() {
|
||||
if (getContext().netDb().lookupLocally(_search.getKey()) != null) {
|
||||
if (getContext().netDbSegmentor().lookupLocally(_search.getKey()) != null) {
|
||||
_search.success();
|
||||
} else {
|
||||
int remaining = _search.getLookupsRemaining();
|
||||
|
||||
@@ -460,10 +460,10 @@ class FloodfillVerifyStoreJob extends JobImpl {
|
||||
private void resend() {
|
||||
// It's safe to check the default netDb first, but if the lookup is for
|
||||
// a client, nearly all RI is expected to be found in the FF netDb.
|
||||
DatabaseEntry ds = getContext().netDb().lookupLocally(_key, _facade._dbid);
|
||||
DatabaseEntry ds = getContext().netDbSegmentor().lookupLocally(_key, _facade._dbid);
|
||||
if ((ds == null) && _facade.isClientDb() && _isRouterInfo)
|
||||
// It's safe to check the floodfill netDb for RI
|
||||
ds = getContext().netDb().lookupLocally(_key, FloodfillNetworkDatabaseSegmentor.MAIN_DBID);
|
||||
ds = getContext().netDbSegmentor().lookupLocally(_key, FloodfillNetworkDatabaseSegmentor.MAIN_DBID);
|
||||
if (ds != null) {
|
||||
// By the time we get here, a minute or more after the store started,
|
||||
// we may have already started a new store
|
||||
|
||||
+2
-2
@@ -38,7 +38,7 @@ public class HandleFloodfillDatabaseLookupMessageJob extends HandleDatabaseLooku
|
||||
*/
|
||||
@Override
|
||||
protected boolean answerAllQueries() {
|
||||
if (!getContext().netDb().floodfillEnabled()) return false;
|
||||
if (!getContext().netDbSegmentor().floodfillEnabled()) return false;
|
||||
return FloodfillNetworkDatabaseFacade.isFloodfill(getContext().router().getRouterInfo());
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class HandleFloodfillDatabaseLookupMessageJob extends HandleDatabaseLooku
|
||||
super.sendClosest(key, routerInfoSet, toPeer, replyTunnel);
|
||||
|
||||
// go away, you got the wrong guy, send our RI back unsolicited
|
||||
if (!getContext().netDb().floodfillEnabled()) {
|
||||
if (!getContext().netDbSegmentor().floodfillEnabled()) {
|
||||
// We could just call sendData(myhash, myri, toPeer, replyTunnel) but
|
||||
// that would increment the netDb.lookupsHandled and netDb.lookupsMatched stats
|
||||
DatabaseStoreMessage msg = new DatabaseStoreMessage(getContext());
|
||||
|
||||
@@ -44,7 +44,7 @@ class RepublishLeaseSetJob extends JobImpl {
|
||||
|
||||
try {
|
||||
if (getContext().clientManager().isLocal(_dest)) {
|
||||
LeaseSet ls = getContext().netDb().lookupLeaseSetLocally(_dest, _dest.toBase32());
|
||||
LeaseSet ls = getContext().netDbSegmentor().lookupLeaseSetLocally(_dest, _dest.toBase32());
|
||||
if (ls != null) {
|
||||
if (!ls.isCurrent(Router.CLOCK_FUDGE_FACTOR)) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
@@ -103,9 +103,9 @@ class RepublishLeaseSetJob extends JobImpl {
|
||||
// Don't requeue if there's a newer LS, KNDF will have already done that
|
||||
LeaseSet ls = null;
|
||||
if (_dest != null)
|
||||
ls = getContext().netDb().lookupLeaseSetLocally(_ls.getHash(), _dest.toBase32());
|
||||
ls = getContext().netDbSegmentor().lookupLeaseSetLocally(_ls.getHash(), _dest.toBase32());
|
||||
else
|
||||
getContext().netDb().lookupLeaseSetLocally(_ls.getHash(), null);
|
||||
getContext().netDbSegmentor().lookupLeaseSetLocally(_ls.getHash(), null);
|
||||
// ^ _dest should never be null here, right? So maybe instead we return immediately?
|
||||
if (ls != null && ls.getEarliestLeaseDate() == _ls.getEarliestLeaseDate()) {
|
||||
requeueRepublish();
|
||||
|
||||
@@ -143,7 +143,7 @@ class SearchJob extends JobImpl {
|
||||
// The other two places this was called (one below and one in FNDF)
|
||||
// have been commented out.
|
||||
// Returning false essentially enables kademlia as a backup to floodfill for search responses.
|
||||
if (ctx.netDb().floodfillEnabled())
|
||||
if (ctx.netDbSegmentor().floodfillEnabled())
|
||||
return false;
|
||||
return ctx.getProperty("netDb.floodfillOnly", DEFAULT_FLOODFILL_ONLY);
|
||||
}
|
||||
@@ -448,7 +448,7 @@ class SearchJob extends JobImpl {
|
||||
// this will fail if we've banlisted our inbound gateway, but the gw may not necessarily
|
||||
// be banlisted by whomever needs to contact them, so we don't need to check this
|
||||
|
||||
//RouterInfo inGateway = getContext().netDb().lookupRouterInfoLocally(inTunnel.getPeer(0));
|
||||
//RouterInfo inGateway = getContext().netDbSegmentor().lookupRouterInfoLocally(inTunnel.getPeer(0));
|
||||
//if (inGateway == null) {
|
||||
// _log.error("We can't find the gateway to our inbound tunnel?!");
|
||||
// getContext().jobQueue().addJob(new FailedJob(getContext(), router));
|
||||
|
||||
@@ -88,11 +88,11 @@ class SearchUpdateReplyFoundJob extends JobImpl implements ReplyJob {
|
||||
switch (entry.getType()) {
|
||||
case DatabaseEntry.KEY_TYPE_ROUTERINFO:
|
||||
RouterInfo ri = (RouterInfo) entry;
|
||||
getContext().netDb().store(ri.getHash(), ri);
|
||||
getContext().netDbSegmentor().store(ri.getHash(), ri);
|
||||
break;
|
||||
case DatabaseEntry.KEY_TYPE_LEASESET:
|
||||
LeaseSet ls = (LeaseSet) entry;
|
||||
getContext().netDb().store(ls.getHash(), ls);
|
||||
getContext().netDbSegmentor().store(ls.getHash(), ls);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ReseedChecker {
|
||||
|
||||
/**
|
||||
* All reseeding must be done through this instance.
|
||||
* Access through context.netDb().reseedChecker(), others should not instantiate
|
||||
* Access through context.netDbSegmentor().reseedChecker(), others should not instantiate
|
||||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
|
||||
@@ -429,7 +429,7 @@ public class Analysis extends JobImpl implements RouterApp, Runnable {
|
||||
continue;
|
||||
if (! _context.clientManager().shouldPublishLeaseSet(client))
|
||||
continue;
|
||||
LeaseSet ls = _context.netDb().lookupLeaseSetLocally(client);
|
||||
LeaseSet ls = _context.netDbSegmentor().lookupLeaseSetLocally(client);
|
||||
if (ls == null)
|
||||
continue;
|
||||
Hash rkey = ls.getRoutingKey();
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Republish implements SimpleTimer.TimedEvent {
|
||||
try {
|
||||
ri = _context.router().getRouterInfo();
|
||||
if (ri != null)
|
||||
_context.netDb().publish(ri);
|
||||
_context.netDbSegmentor().publish(ri);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
Log log = _context.logManager().getLog(Router.class);
|
||||
// clock skew / shift race?
|
||||
|
||||
@@ -34,7 +34,7 @@ public class Restarter implements Runnable {
|
||||
log.logAlways(Log.WARN, "Restarted the tunnel manager");
|
||||
|
||||
//try { _context.peerManager().restart(); } catch (Throwable t) { log.log(Log.CRIT, "Error restarting the peer manager", t); }
|
||||
//try { _context.netDb().restart(); } catch (Throwable t) { log.log(Log.CRIT, "Error restarting the networkDb", t); }
|
||||
//try { _context.netDbSegmentor().restart(); } catch (Throwable t) { log.log(Log.CRIT, "Error restarting the networkDb", t); }
|
||||
//try { _context.jobQueue().restart(); } catch (Throwable t) { log.log(Log.CRIT, "Error restarting the job queue", t); }
|
||||
|
||||
try { Thread.sleep(10*1000); } catch (InterruptedException ie) {}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class UpdateRoutingKeyModifierJob extends JobImpl {
|
||||
// tell netdb if mod data changed
|
||||
boolean changed = gen.generateDateBasedModData();
|
||||
if (changed)
|
||||
getContext().netDb().routingKeyChanged();
|
||||
getContext().netDbSegmentor().routingKeyChanged();
|
||||
requeue(delay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -755,7 +755,7 @@ public class GeoIP {
|
||||
* @since 0.9.48
|
||||
*/
|
||||
private static void banCountry(RouterContext ctx, String country) {
|
||||
for (Hash h : ctx.netDb().getAllRouters()) {
|
||||
for (Hash h : ctx.netDbSegmentor().getAllRouters()) {
|
||||
String hisCountry = ctx.commSystem().getCountry(h);
|
||||
if (country.equals(hisCountry)) {
|
||||
ctx.banlist().banlistRouterHard(h, "In our country");
|
||||
|
||||
@@ -199,7 +199,7 @@ public abstract class TransportImpl implements Transport {
|
||||
break;
|
||||
}
|
||||
|
||||
if (_context.netDb().floodfillEnabled()) {
|
||||
if (_context.netDbSegmentor().floodfillEnabled()) {
|
||||
// && !SystemVersion.isWindows()) {
|
||||
def *= 17; def /= 10;
|
||||
}
|
||||
|
||||
@@ -689,7 +689,7 @@ class InboundEstablishState extends EstablishBase implements NTCP2Payload.Payloa
|
||||
}
|
||||
|
||||
try {
|
||||
RouterInfo old = _context.netDb().store(h, ri);
|
||||
RouterInfo old = _context.netDbSegmentor().store(h, ri);
|
||||
if (flood && !ri.equals(old)) {
|
||||
FloodfillNetworkDatabaseFacade fndf = (FloodfillNetworkDatabaseFacade) _context.mainNetDb();
|
||||
if (fndf.floodConditional(ri)) {
|
||||
|
||||
@@ -1668,7 +1668,7 @@ public class NTCPConnection implements Closeable {
|
||||
try {
|
||||
if (h.equals(_context.routerHash()))
|
||||
return;
|
||||
RouterInfo old = _context.netDb().store(h, ri);
|
||||
RouterInfo old = _context.netDbSegmentor().store(h, ri);
|
||||
if (flood && !ri.equals(old)) {
|
||||
FloodfillNetworkDatabaseFacade fndf = (FloodfillNetworkDatabaseFacade) _context.mainNetDb();
|
||||
if ((old == null || ri.getPublished() > old.getPublished()) &&
|
||||
|
||||
@@ -374,7 +374,7 @@ class InboundEstablishState2 extends InboundEstablishState implements SSU2Payloa
|
||||
_mtu = mtu;
|
||||
|
||||
try {
|
||||
RouterInfo old = _context.netDb().store(h, ri);
|
||||
RouterInfo old = _context.netDbSegmentor().store(h, ri);
|
||||
if (flood && !ri.equals(old)) {
|
||||
FloodfillNetworkDatabaseFacade fndf = (FloodfillNetworkDatabaseFacade) _context.mainNetDb();
|
||||
if (fndf.floodConditional(ri)) {
|
||||
|
||||
@@ -632,7 +632,7 @@ public class PeerState2 extends PeerState implements SSU2Payload.PayloadCallback
|
||||
Hash h = ri.getHash();
|
||||
if (h.equals(_context.routerHash()))
|
||||
return;
|
||||
RouterInfo old = _context.netDb().store(h, ri);
|
||||
RouterInfo old = _context.netDbSegmentor().store(h, ri);
|
||||
if (flood && !ri.equals(old)) {
|
||||
FloodfillNetworkDatabaseFacade fndf = (FloodfillNetworkDatabaseFacade) _context.mainNetDb();
|
||||
if ((old == null || ri.getPublished() > old.getPublished()) &&
|
||||
|
||||
@@ -2568,7 +2568,7 @@ class PeerTestManager {
|
||||
Hash h = ri.getHash();
|
||||
if (h.equals(_context.routerHash()))
|
||||
return;
|
||||
_context.netDb().store(h, ri);
|
||||
_context.netDbSegmentor().store(h, ri);
|
||||
// ignore flood request
|
||||
} catch (IllegalArgumentException iae) {
|
||||
if (_log.shouldWarn())
|
||||
|
||||
@@ -3459,7 +3459,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
(!_context.router().isHidden()) &&
|
||||
(!introducersRequired(ipv6)) &&
|
||||
haveCapacity() &&
|
||||
(!_context.netDb().floodfillEnabled()) &&
|
||||
(!_context.netDbSegmentor().floodfillEnabled()) &&
|
||||
(!ipv6 || _haveIPv6Address) &&
|
||||
((!ipv6 && getIPv6Config() != IPV6_ONLY) ||
|
||||
(ipv6 && getIPv6Config() != IPV6_DISABLED)) &&
|
||||
@@ -3849,7 +3849,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
boolean shouldPingFirewall = !STATUS_OK.contains(_reachabilityStatus);
|
||||
int currentListenPort = getListenPort(false);
|
||||
boolean pingOneOnly = shouldPingFirewall && getExternalPort(false) == currentListenPort;
|
||||
boolean shortLoop = shouldPingFirewall || !haveCap || _context.netDb().floodfillEnabled();
|
||||
boolean shortLoop = shouldPingFirewall || !haveCap || _context.netDbSegmentor().floodfillEnabled();
|
||||
long loopTime = shortLoop ? SHORT_LOOP_TIME : LONG_LOOP_TIME;
|
||||
_lastLoopShort = shortLoop;
|
||||
_expireBuffer.clear();
|
||||
|
||||
@@ -140,9 +140,9 @@ class InboundMessageDistributor implements GarlicMessageReceiver.CloveReceiver {
|
||||
return;
|
||||
RouterInfo oldri = null;
|
||||
if (_client != null)
|
||||
oldri = _context.netDb().lookupRouterInfoLocally(key, _client.toBase32());
|
||||
oldri = _context.netDbSegmentor().lookupRouterInfoLocally(key, _client.toBase32());
|
||||
else
|
||||
oldri = _context.netDb().lookupRouterInfoLocally(key, FloodfillNetworkDatabaseSegmentor.MAIN_DBID);
|
||||
oldri = _context.netDbSegmentor().lookupRouterInfoLocally(key, FloodfillNetworkDatabaseSegmentor.MAIN_DBID);
|
||||
// only update if RI is newer and non-ff
|
||||
if (oldri != null && oldri.getPublished() < ri.getPublished() &&
|
||||
!FloodfillNetworkDatabaseFacade.isFloodfill(ri)) {
|
||||
@@ -242,7 +242,7 @@ class InboundMessageDistributor implements GarlicMessageReceiver.CloveReceiver {
|
||||
// Handling of client tunnel messages need explicit handling
|
||||
// in the context of the client subDb.
|
||||
if (_client != null) {
|
||||
String dbid = _context.netDb().getDbidByHash(_client);
|
||||
String dbid = _context.netDbSegmentor().getDbidByHash(_client);
|
||||
if (dbid == null) {
|
||||
// This error shouldn't occur. All clients should have their own netDb.
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
@@ -271,7 +271,7 @@ class InboundMessageDistributor implements GarlicMessageReceiver.CloveReceiver {
|
||||
if (dsm.getEntry().isLeaseSet()) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("[client: " + _clientNickname + "] Saving LS DSM from client tunnel.");
|
||||
FloodfillDatabaseStoreMessageHandler _FDSMH = new FloodfillDatabaseStoreMessageHandler(_context, _context.netDb().getSubNetDB(dbid));
|
||||
FloodfillDatabaseStoreMessageHandler _FDSMH = new FloodfillDatabaseStoreMessageHandler(_context, _context.netDbSegmentor().getSubNetDB(dbid));
|
||||
Job j = _FDSMH.createJob(msg, null, null);
|
||||
j.runJob();
|
||||
if (sz > 0) {
|
||||
@@ -394,7 +394,7 @@ class InboundMessageDistributor implements GarlicMessageReceiver.CloveReceiver {
|
||||
|
||||
String dbid = null;
|
||||
if (_client != null)
|
||||
dbid = _context.netDb().getDbidByHash(_client);
|
||||
dbid = _context.netDbSegmentor().getDbidByHash(_client);
|
||||
if (dbid != null) {
|
||||
// We need to replicate some of the handling that was previously
|
||||
// performed when these types of messages were passed back to
|
||||
@@ -407,7 +407,7 @@ class InboundMessageDistributor implements GarlicMessageReceiver.CloveReceiver {
|
||||
// ToDo: This should actually have a try and catch.
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Store the LS in the correct dbid subDb: " + dbid);
|
||||
FloodfillDatabaseStoreMessageHandler _FDSMH = new FloodfillDatabaseStoreMessageHandler(_context, _context.netDb().getSubNetDB(dbid));
|
||||
FloodfillDatabaseStoreMessageHandler _FDSMH = new FloodfillDatabaseStoreMessageHandler(_context, _context.netDbSegmentor().getSubNetDB(dbid));
|
||||
Job j = _FDSMH.createJob(data, null, null);
|
||||
j.runJob();
|
||||
if (sz > 0) {
|
||||
|
||||
@@ -116,7 +116,7 @@ public class AliasedTunnelPool extends TunnelPool {
|
||||
@Override
|
||||
protected LeaseSet locked_buildNewLeaseSet() {
|
||||
String base32 = _aliasOf.getSettings().getDestination().toBase32();
|
||||
LeaseSet ls = _context.netDb().lookupLeaseSetLocally(_aliasOf.getSettings().getDestination(), base32);
|
||||
LeaseSet ls = _context.netDbSegmentor().lookupLeaseSetLocally(_aliasOf.getSettings().getDestination(), base32);
|
||||
if (ls == null)
|
||||
return null;
|
||||
// copy everything so it isn't corrupted
|
||||
|
||||
@@ -280,7 +280,7 @@ class ExploratoryPeerSelector extends TunnelPeerSelector {
|
||||
} else {
|
||||
// If well connected or ff, don't pick from high cap
|
||||
// even during congestion, because congestion starts from the top
|
||||
if (active > 500 || ctx.netDb().floodfillEnabled())
|
||||
if (active > 500 || ctx.netDbSegmentor().floodfillEnabled())
|
||||
return false;
|
||||
|
||||
failPct = getExploratoryFailPercentage();
|
||||
|
||||
@@ -357,7 +357,7 @@ public class TunnelPool {
|
||||
return rv;
|
||||
}
|
||||
// TODO high-bw non-ff also
|
||||
if (_context.netDb().floodfillEnabled() &&
|
||||
if (_context.netDbSegmentor().floodfillEnabled() &&
|
||||
_context.router().getUptime() > 5*60*1000) {
|
||||
rv += 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user