Skip to content

Commit

Permalink
NetDB: fix race conditions and inefficiencies in new subDb renderer, …
Browse files Browse the repository at this point in the history
…fix equals/== in new subDb renderer, ensure we get the right LeaseSet from the client Db by looking it up locally using the client hash
  • Loading branch information
eyedeekay committed Sep 24, 2024
1 parent 610baa8 commit 0dbce02
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -699,14 +699,13 @@ public void renderLeaseSetHTML(Writer out, boolean debug, Hash client) throws IO
}
leases.addAll(netdb.getLeases());
LeaseSet myLeaseSet = new LeaseSet();
if (netdb.getLeases().size() > 0)
myLeaseSet = new ArrayList<LeaseSet>(netdb.getLeases()).get(0);
if (leases.size() > 0)
myLeaseSet = netdb.lookupLeaseSetLocally(client);
int medianCount = 0;
int rapCount = 0;
BigInteger median = null;
int c = 0;


// Summary
if (debug) {
buf.append("<table id=\"leasesetdebug\">\n");
Expand All @@ -716,7 +715,7 @@ public void renderLeaseSetHTML(Writer out, boolean debug, Hash client) throws IO
if (client != null) {
buf.append("<tr><th colspan=\"3\">").append(_t("Leasesets for Client")).append(": ");
buf.append(client.toBase32());
if (netdb.getLeases().size() > 0) {
if (leases.size() > 0) {
TunnelPoolSettings in = _context.tunnelManager().getInboundSettings(myLeaseSet.getHash());
if (in != null && in.getDestinationNickname() != null)
buf.append(" - ").append(DataHelper.escapeHTML(in.getDestinationNickname()));
Expand Down Expand Up @@ -833,7 +832,7 @@ public void renderLeaseSetHTML(Writer out, boolean debug, Hash client) throws IO
} else {
distance = null;
}
if (myLeaseSet == null || ls.getHash() != myLeaseSet.getHash()) {
if (ls.getHash().equals(myLeaseSet.getHash())) {
renderLeaseSet(buf, ls, debug, now, linkSusi, distance);
out.write(buf.toString());
buf.setLength(0);
Expand Down

0 comments on commit 0dbce02

Please sign in to comment.