forked from I2P_Developers/i2p.i2p
Compare commits
3 Commits
i2p-2.5.0-
...
i2p.i2p-2.
Author | SHA1 | Date | |
---|---|---|---|
cbe425595c | |||
5eff75b7a6 | |||
03fe3fc184 |
@ -90,11 +90,6 @@ public class DummyNetworkDatabaseFacade extends SegmentedNetworkDatabaseFacade {
|
||||
public Set<Hash> getAllRouters() { return new HashSet<Hash>(_routers.keySet()); }
|
||||
public Set<Hash> findNearestRouters(Hash key, int maxNumRouters, Set<Hash> peersToIgnore) { return getAllRouters(); }
|
||||
|
||||
@Override
|
||||
public LeaseSet lookupLeaseSetHashIsClient(Hash key) {
|
||||
throw new UnsupportedOperationException("Unimplemented method 'lookupLeaseSetHashIsClient'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public FloodfillNetworkDatabaseFacade mainNetDB() {
|
||||
return _fndb;
|
||||
|
@ -476,9 +476,7 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean floodfillEnabled() {
|
||||
if (isMultihomeDb())
|
||||
return _context.netDb().floodfillEnabled();
|
||||
public boolean floodfillEnabled() {
|
||||
return _floodfillEnabled;
|
||||
}
|
||||
|
||||
|
@ -121,98 +121,6 @@ public class FloodfillNetworkDatabaseSegmentor extends SegmentedNetworkDatabaseF
|
||||
_multihomeDbid.startup();
|
||||
}
|
||||
|
||||
/**
|
||||
* list of the RouterInfo objects for all known peers;
|
||||
*
|
||||
* @since 0.9.60
|
||||
* @return non-null
|
||||
*/
|
||||
public List<RouterInfo> getKnownRouterData() {
|
||||
List<RouterInfo> rv = new ArrayList<RouterInfo>();
|
||||
for (FloodfillNetworkDatabaseFacade subdb : getSubNetDBs()) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("getKnownRouterData Called from FNDS,"+subdb._dbid+", will be combined with all other subDbs");
|
||||
rv.addAll(subdb.getKnownRouterData());
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* list of the Hashes of currently known floodfill peers;
|
||||
* Returned list will not include our own hash.
|
||||
* List is not sorted and not shuffled.
|
||||
*
|
||||
* @since 0.9.60
|
||||
* @return non-null
|
||||
*/
|
||||
public List<Hash> getFloodfillPeers() {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("getFloodfillPeers collecting all floodfill peers across all subDbs");
|
||||
List<Hash> peers = new ArrayList<Hash>();
|
||||
for (FloodfillNetworkDatabaseFacade subdb : getSubNetDBs()) {
|
||||
peers.addAll(subdb.getFloodfillPeers());
|
||||
}
|
||||
return peers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup using the client's tunnels when the client LS key is know
|
||||
* but the client dbid is not.
|
||||
*
|
||||
* @param key The LS key for client.
|
||||
* @return may be null
|
||||
* @since 0.9.60
|
||||
*/
|
||||
@Override
|
||||
public LeaseSet lookupLeaseSetHashIsClient(Hash key) {
|
||||
return lookupLeaseSetLocally(key, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup using the client's tunnels when the client LS key is known.
|
||||
* if a DBID is not provided, the clients will all be checked, and the
|
||||
* first value will be used.
|
||||
*
|
||||
* @return may be null
|
||||
* @since 0.9.60
|
||||
*/
|
||||
//@Override
|
||||
protected LeaseSet lookupLeaseSetLocally(Hash key, Hash dbid) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("lookupLeaseSetLocally on all subDbs: " + key.toBase32());
|
||||
if (dbid == null) {
|
||||
LeaseSet rv = null;
|
||||
for (FloodfillNetworkDatabaseFacade subdb : getClientSubNetDBs()) {
|
||||
rv = subdb.lookupLeaseSetLocally(key);
|
||||
if (rv != null) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.getSubNetDB(dbid).lookupLeaseSetLocally(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if all of the known subDbs are initialized
|
||||
*
|
||||
* @since 0.9.60
|
||||
* @return true if the mainNetdb and all known client netDbs are initialized
|
||||
*/
|
||||
public boolean isInitialized() {
|
||||
if (_mainDbid == null)
|
||||
return false;
|
||||
boolean rv = _mainDbid.isInitialized();
|
||||
if (!rv)
|
||||
return rv;
|
||||
for (FloodfillNetworkDatabaseFacade subdb : getClientSubNetDBs()) {
|
||||
rv = subdb.isInitialized();
|
||||
if (!rv) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* list of the RouterInfo objects for all known peers known to clients(in subDbs) only
|
||||
*
|
||||
@ -289,33 +197,6 @@ public class FloodfillNetworkDatabaseSegmentor extends SegmentedNetworkDatabaseF
|
||||
return mainNetDB();
|
||||
}
|
||||
|
||||
/**
|
||||
* look up the dbid of the client or clients with the given signing
|
||||
* public key
|
||||
*
|
||||
* @since 0.9.60
|
||||
* @return non-null
|
||||
*/
|
||||
@Override
|
||||
public List<Hash> lookupClientBySigningPublicKey(SigningPublicKey spk) {
|
||||
List<Hash> rv = new ArrayList<>();
|
||||
for (Hash subdb : _context.clientManager().getPrimaryHashes()) {
|
||||
FloodfillNetworkDatabaseFacade fndf = _context.clientManager().getClientFloodfillNetworkDatabaseFacade(subdb);
|
||||
if (fndf == null)
|
||||
continue;
|
||||
// if (subdb.startsWith("clients_"))
|
||||
// TODO: see if we can access only one subDb at a time when we need
|
||||
// to look up a client by SPK. We mostly need this for managing blinded
|
||||
// and encrypted keys in the Keyring Config UI page. See also
|
||||
// ConfigKeyringHelper
|
||||
BlindData bd = fndf.getBlindData(spk);
|
||||
if (bd != null) {
|
||||
rv.add(subdb);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* get all the subDbs and return them in a Set. This includes the main netDb
|
||||
* and the possible-multihomes netDb
|
||||
@ -357,19 +238,4 @@ public class FloodfillNetworkDatabaseSegmentor extends SegmentedNetworkDatabaseF
|
||||
rv.addAll(_context.clientManager().getClientFloodfillNetworkDatabaseFacades());
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* list of the BlindData objects for all known clients
|
||||
*
|
||||
* @since 0.9.60
|
||||
* @return non-null
|
||||
*/
|
||||
@Override
|
||||
public List<BlindData> getLocalClientsBlindData() {
|
||||
List<BlindData> rv = new ArrayList<>();
|
||||
for (FloodfillNetworkDatabaseFacade subdb : getClientSubNetDBs()) {
|
||||
rv.addAll(subdb.getBlindData());
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
@ -972,13 +972,6 @@ public abstract class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacad
|
||||
return _lastRIPublishTime;
|
||||
}
|
||||
|
||||
public boolean matchClientKey(Hash key) {
|
||||
if ((_localKey != null) && (_localKey.equals(key)))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist the local router's info (as updated) into netDb/my.info, since
|
||||
* ./router.info isn't always updated. This also allows external applications
|
||||
|
@ -113,13 +113,6 @@ public abstract class SegmentedNetworkDatabaseFacade {
|
||||
* @since 0.9.60
|
||||
*/
|
||||
public abstract void startup();
|
||||
/**
|
||||
* Lookup the leaseSet for a given key in only client dbs.
|
||||
*
|
||||
* @return may be null
|
||||
* @since 0.9.60
|
||||
*/
|
||||
public abstract LeaseSet lookupLeaseSetHashIsClient(Hash key);
|
||||
/**
|
||||
* Get a set of all sub-netDbs.
|
||||
*
|
||||
@ -195,15 +188,6 @@ public abstract class SegmentedNetworkDatabaseFacade {
|
||||
* */
|
||||
public ReseedChecker reseedChecker() {
|
||||
return mainNetDB().reseedChecker();
|
||||
};
|
||||
/**
|
||||
* For console ConfigKeyringHelper
|
||||
*
|
||||
* @return non-null
|
||||
* @since 0.9.60
|
||||
*/
|
||||
public List<Hash> lookupClientBySigningPublicKey(SigningPublicKey spk) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
/**
|
||||
* For console ConfigKeyringHelper
|
||||
|
Reference in New Issue
Block a user