Skip to content

Commit

Permalink
Router: re-create multihomeNetDb functionality on top of new SNDF API
Browse files Browse the repository at this point in the history
  • Loading branch information
eyedeekay committed Sep 20, 2023
1 parent ceb53db commit fa24e11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,7 @@ else if (getContext().clientManager().isLocal(key))
getContext().statManager().addRateData("netDb.storeLocalLeaseSetAttempt", 1, 0);
// throw rather than return, so that we send the ack below (prevent easy attack)
dontBlamePeer = true;
// store the peer in the outboundCache instead so that we can reply back with it without confusing ourselves.
if (ls.isCurrent(Router.CLOCK_FUDGE_FACTOR / 4)) {
if (_facade.validate(key, ls) == null) {
LeaseSet compareLeasesetDate = getContext().clientMessagePool().getCache().multihomedCache.get(key);
if (compareLeasesetDate == null)
getContext().clientMessagePool().getCache().multihomedCache.put(key, ls);
else if (compareLeasesetDate.getEarliestLeaseDate() < ls.getEarliestLeaseDate())
getContext().clientMessagePool().getCache().multihomedCache.put(key, ls);
}
}
getContext().multihomeNetDb().store(key, ls);
throw new IllegalArgumentException("(dbid: " + _facade._dbid
+ ") Peer attempted to store local leaseSet: "
+ key.toBase32());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,10 @@ private void readFiles() {
_lastReseed = _context.clock().now();
_setNetDbReady = true;
setNetDbReady();
} else if (_facade.isMultihomeDb()) {
_lastReseed = _context.clock().now();
_setNetDbReady = true;
setNetDbReady();
} else if (_facade.reseedChecker().checkReseed(routerCount)) {
_lastReseed = _context.clock().now();
// checkReseed will call wakeup() when done and we will run again
Expand All @@ -494,6 +498,8 @@ private void readFiles() {
int count = Math.min(routerCount, size());
if (_facade.isClientDb()) {
_lastReseed = _context.clock().now();
} else if (_facade.isMultihomeDb()) {
_lastReseed = _context.clock().now();
} else if (count < MIN_ROUTERS) {
if (_facade.reseedChecker().checkReseed(count))
_lastReseed = _context.clock().now();
Expand Down

0 comments on commit fa24e11

Please sign in to comment.