Skip to content

Commit

Permalink
Router: eliminate useSubDbs option except for 2 comments in FNDS
Browse files Browse the repository at this point in the history
  • Loading branch information
eyedeekay committed Oct 26, 2023
1 parent 569e2e8 commit 44fce96
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1185,8 +1185,6 @@ private boolean alreadyAccepted(MessageId id) {
* @since 0.9.60
*/
public FloodfillNetworkDatabaseFacade getFloodfillNetworkDatabaseFacade() {
if (!_context.netDbSegmentor().useSubDbs())
return _context.netDb();
if (_log.shouldLog(Log.DEBUG))
_log.debug("getFloodfillNetworkDatabaseFacade is getting the subDb for dbid: " + this.getDestHash());
if (_floodfillNetworkDatabaseFacade == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
public class FloodfillNetworkDatabaseSegmentor extends SegmentedNetworkDatabaseFacade {
protected final Log _log;
private RouterContext _context;
private static final String PROP_NETDB_ISOLATION = "router.netdb.isolation";
//private static final String PROP_NETDB_ISOLATION = "router.netdb.isolation";
public static final Hash MAIN_DBID = null;
private final FloodfillNetworkDatabaseFacade _mainDbid;

Expand All @@ -69,9 +69,10 @@ public FloodfillNetworkDatabaseSegmentor(RouterContext context) {
_mainDbid = new FloodfillNetworkDatabaseFacade(_context, MAIN_DBID);
}

/* Commented out prior to 2.4.0 release, might be worth resurrecting at some point
public boolean useSubDbs() {
return _context.getProperty(PROP_NETDB_ISOLATION, true);
}
}*/

/**
* Retrieves the FloodfillNetworkDatabaseFacade object for the specified ID.
Expand All @@ -82,8 +83,6 @@ public boolean useSubDbs() {
*/
@Override
protected FloodfillNetworkDatabaseFacade getSubNetDB(Hash id) {
if (!useSubDbs())
return _mainDbid;
return _context.clientManager().getClientFloodfillNetworkDatabaseFacade(id);
}

Expand Down Expand Up @@ -259,8 +258,6 @@ public FloodfillNetworkDatabaseFacade mainNetDB() {
public FloodfillNetworkDatabaseFacade clientNetDB(Hash id) {
if (_log.shouldDebug())
_log.debug("looked up clientNetDB: " + id);
if (!useSubDbs())
return _mainDbid;
if (id != null){
FloodfillNetworkDatabaseFacade fndf = getSubNetDB(id);
if (fndf != null)
Expand Down Expand Up @@ -308,10 +305,6 @@ public Set<FloodfillNetworkDatabaseFacade> getSubNetDBs() {
if (!_mainDbid.isInitialized())
return Collections.emptySet();
Set<FloodfillNetworkDatabaseFacade> rv = new HashSet<>();
if (!useSubDbs()) {
rv.add(_mainDbid);
return rv;
}
rv.add(_mainDbid);
rv.addAll(_context.clientManager().getClientFloodfillNetworkDatabaseFacades());
return rv;
Expand All @@ -329,10 +322,6 @@ private Set<FloodfillNetworkDatabaseFacade> getClientSubNetDBs() {
if (!_mainDbid.isInitialized())
return Collections.emptySet();
Set<FloodfillNetworkDatabaseFacade> rv = new HashSet<>();
if (!useSubDbs()) {
rv.add(_mainDbid);
return rv;
}
rv.addAll(_context.clientManager().getClientFloodfillNetworkDatabaseFacades());
return rv;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -881,24 +881,22 @@ public void publish(LeaseSet localLeaseSet) throws IllegalArgumentException {
_log.error("locally published leaseSet is not valid?", iae);
throw iae;
}
if (!_context.netDbSegmentor().useSubDbs()){
String dbid = "main netDb";
if (isClientDb()) {
dbid = "client netDb: " + _dbid;
}
if (_localKey != null) {
if (!_localKey.equals(localLeaseSet.getHash()))
if (_log.shouldLog(Log.ERROR))
_log.error("[" + dbid + "]" + "Error, the local LS hash ("
+ _localKey + ") does not match the published hash ("
+ localLeaseSet.getHash() + ")! This shouldn't happen!",
new Exception());
} else {
// This will only happen once when the local LS is first published
_localKey = localLeaseSet.getHash();
if (_log.shouldLog(Log.INFO))
_log.info("[" + dbid + "]" + "Local client LS key initialized to: " + _localKey);
}
String dbid = "main netDb";
if (isClientDb()) {
dbid = "client netDb: " + _dbid;
}
if (_localKey != null) {
if (!_localKey.equals(localLeaseSet.getHash()))
if (_log.shouldLog(Log.ERROR))
_log.error("[" + dbid + "]" + "Error, the local LS hash ("
+ _localKey + ") does not match the published hash ("
+ localLeaseSet.getHash() + ")! This shouldn't happen!",
new Exception());
} else {
// This will only happen once when the local LS is first published
_localKey = localLeaseSet.getHash();
if (_log.shouldLog(Log.INFO))
_log.info("[" + dbid + "]" + "Local client LS key initialized to: " + _localKey);
}
if (!_context.clientManager().shouldPublishLeaseSet(h))
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,6 @@ public abstract class SegmentedNetworkDatabaseFacade {
public SegmentedNetworkDatabaseFacade(RouterContext context) {
// super(context, null);
}

/**
* Determine whether to use subDb defenses at all or to use the extant FNDF/RAP/RAR defenses
*
* @return true if using subDbs, false if not
* @since 0.9.60
*/
public boolean useSubDbs() {
return false;
}

/**
* Get a sub-netDb using a Hash identifier
Expand Down

0 comments on commit 44fce96

Please sign in to comment.