Skip to content

Commit

Permalink
Router: Don't publish local RI unless dbid is floodfill
Browse files Browse the repository at this point in the history
  • Loading branch information
eyedeekay committed Aug 4, 2023
1 parent 42f2dd0 commit ecb3e2a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ public synchronized void shutdown() {
* @throws IllegalArgumentException if the local router info is invalid
*/
public void publish(RouterInfo localRouterInfo) throws IllegalArgumentException {
floodfillNetDB().publish(localRouterInfo);
if (localRouterInfo == null)
throw new IllegalArgumentException("localRouterInfo must not be null");
if (localRouterInfo.getReceivedBy() == null)
floodfillNetDB().publish(localRouterInfo);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,21 +359,23 @@ public synchronized void startup() {
_log.warn("Operating in quiet mode - not exploring or pushing data proactively, simply reactively");
_log.warn("This should NOT be used in production");
}
// periodically update and resign the router's 'published date', which basically
// serves as a version
Job plrij = new PublishLocalRouterInfoJob(_context);
// do not delay this, as this creates the RI too, and we need a good local routerinfo right away
//plrij.getTiming().setStartAfter(_context.clock().now() + PUBLISH_JOB_DELAY);
_context.jobQueue().addJob(plrij);
if (_dbid == null || _dbid.equals("floodfill") || _dbid.isEmpty()) {
// periodically update and resign the router's 'published date', which basically
// serves as a version
Job plrij = new PublishLocalRouterInfoJob(_context);
// do not delay this, as this creates the RI too, and we need a good local routerinfo right away
//plrij.getTiming().setStartAfter(_context.clock().now() + PUBLISH_JOB_DELAY);
_context.jobQueue().addJob(plrij);

// plrij calls publish() for us
//try {
// publish(ri);
//} catch (IllegalArgumentException iae) {
// _context.router().rebuildRouterInfo(true);
// //_log.log(Log.CRIT, "Our local router info is b0rked, clearing from scratch", iae);
// //_context.router().rebuildNewIdentity();
//}
// plrij calls publish() for us
//try {
// publish(ri);
//} catch (IllegalArgumentException iae) {
// _context.router().rebuildRouterInfo(true);
// //_log.log(Log.CRIT, "Our local router info is b0rked, clearing from scratch", iae);
// //_context.router().rebuildNewIdentity();
//}
}
}

/** unused, see override */
Expand Down

0 comments on commit ecb3e2a

Please sign in to comment.