mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-25 12:27:58 +01:00
q refactor break out assemblepath
This commit is contained in:
parent
dd4277b33d
commit
20434ad9f6
1 changed files with 56 additions and 52 deletions
|
@ -508,8 +508,6 @@ class Query(
|
||||||
val authRpaths: HashMap<Fingerprint, Pair<Path, Int>> = hashMapOf()
|
val authRpaths: HashMap<Fingerprint, Pair<Path, Int>> = hashMapOf()
|
||||||
|
|
||||||
for ((issuerFpr, fp) in bestNextNode.entries) {
|
for ((issuerFpr, fp) in bestNextNode.entries) {
|
||||||
var fp = fp // Shadow for write access
|
|
||||||
|
|
||||||
// If roots were specified, then only return the optimal
|
// If roots were specified, then only return the optimal
|
||||||
// paths from the roots.
|
// paths from the roots.
|
||||||
if (roots.size() > 0 && !roots.isRoot(issuerFpr)) {
|
if (roots.size() > 0 && !roots.isRoot(issuerFpr)) {
|
||||||
|
@ -565,7 +563,17 @@ class Query(
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("Recovering path starting at {}", network.nodeByFpr(issuerFpr))
|
logger.debug("Recovering path starting at {}", network.nodeByFpr(issuerFpr))
|
||||||
|
val path = assemblePath(target, targetFpr, targetUserid, issuer, fp, bestNextNode, filter, selfSigned)
|
||||||
|
logger.debug("Authenticated <{}, {}>:\n{}", targetFpr, targetUserid, path)
|
||||||
|
|
||||||
|
authRpaths[issuerFpr] = path
|
||||||
|
}
|
||||||
|
|
||||||
|
return authRpaths
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun assemblePath(target: Node, targetFpr: Fingerprint, targetUserid: String, issuer: Node, fp: ForwardPointer, bestNextNode: HashMap<Fingerprint, ForwardPointer>, filter: CertificationFilter, selfSigned: Boolean): Pair<Path, Int> {
|
||||||
|
var fp = fp // shadow for write access
|
||||||
var amount = 120
|
var amount = 120
|
||||||
|
|
||||||
// nodes[0] is the root; nodes[nodes.len() - 1] is the target.
|
// nodes[0] is the root; nodes[nodes.len() - 1] is the target.
|
||||||
|
@ -613,11 +621,7 @@ class Query(
|
||||||
for (n in nodes.iterator()) {
|
for (n in nodes.iterator()) {
|
||||||
p.append(n)
|
p.append(n)
|
||||||
}
|
}
|
||||||
logger.debug("Authenticated <{}, {}>:\n{}", targetFpr, targetUserid, p)
|
|
||||||
|
|
||||||
authRpaths[issuerFpr] = Pair(p, amount)
|
return Pair(p, amount)
|
||||||
}
|
|
||||||
|
|
||||||
return authRpaths
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue