Skip to content

Commit

Permalink
Console: Resolve some of the netDb rendering issues on .netdb
Browse files Browse the repository at this point in the history
  • Loading branch information
eyedeekay committed Aug 21, 2023
1 parent b98654b commit e3d6e22
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ public String getFloodfillNetDbSummary() {
public String getNetDbSummary(String client, boolean clientOnly) {
NetDbRenderer renderer = new NetDbRenderer(_context);
try {
renderNavBar();
if (!clientOnly)
renderNavBar();
if (_routerPrefix != null || _version != null || _country != null ||
_family != null || _caps != null || _ip != null || _sybil != null ||
_port != 0 || _type != null || _mtu != null || _ipv6 != null ||
Expand Down Expand Up @@ -356,8 +357,7 @@ else if ((_mode == 13 || _mode == 16) && !_postOK)
public String getClientNetDbSummaries() {
String rv = "";
for (String client : _context.netDb().getClients()){
rv += "<div id=\"client_" + client + "\">\n";
rv += "<h3>Client Network Database for " + client + "</h3>\n";
rv += "<div id=\"" + client + "\">\n";
rv += getClientNetDbSummary(client) + "\n";
rv += "</div>\n";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public List<RouterInfo> pickRandomFloodfillPeers() {
int count = getFloodfillPeers().size();
if (count == 0)
return list;
// pick a random number of routers between 4 and 4+1% of the total routers
// pick a random number of routers between 4 and 4+1% of the total routers we know about.
int max = minFloodfillPeers() + (count / 100);
while (list.size() < max) {
int randVal = new RandomSource(_context).nextInt(count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ private FloodfillNetworkDatabaseFacade GetSubNetDB(String id) {
_subDBs.put(id, subdb);
subdb.startup();
subdb.createHandlers();
List<RouterInfo> ris = floodfillNetDB().pickRandomFloodfillPeers();
for (RouterInfo ri : ris) {
if (_log.shouldLog(_log.DEBUG))
_log.debug("Seeding: " + id + " with " + ris.size() + " peers " + ri.getHash());
subdb.store(ri.getIdentity().getHash(), ri);
if (subdb.getFloodfillPeers().size() == 0) {
List<RouterInfo> ris = floodfillNetDB().pickRandomFloodfillPeers();
for (RouterInfo ri : ris) {
if (_log.shouldLog(_log.DEBUG))
_log.debug("Seeding: " + id + " with " + ris.size() + " peers " + ri.getHash());
subdb.store(ri.getIdentity().getHash(), ri);
}
}
}
return subdb;
Expand Down

0 comments on commit e3d6e22

Please sign in to comment.