mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-08-29 01:18:55 +00:00
fix(#1197): plumb hop-context to handleNodePaths resolveWithContext (GREEN)
routes.go:1428 (handleNodePaths) was the last production call site still passing nil context to pm.resolveWithContext. handleNodePaths aggregates paths that terminate at the queried node (lowerPK), so seeding the resolver with [lowerPK] lets tier-1/2 hop-context disambiguation light up for prefix collisions on the destination — exactly the regression class #1197 targets. Verified by extended call-site gate (resolve_context_callsites_test.go) which now passes across all cmd/server/*.go.
This commit is contained in:
@@ -1421,11 +1421,17 @@ func (s *Server) handleNodePaths(w http.ResponseWriter, r *http.Request) {
|
||||
pathGroups := map[string]*pathAgg{}
|
||||
totalTransmissions := 0
|
||||
hopCache := make(map[string]*nodeInfo)
|
||||
// Anchor the resolver with the node being queried so tier-1/2 hop-context
|
||||
// resolution lights up when a hop prefix matches the destination node
|
||||
// (handleNodePaths aggregates paths terminating at lowerPK). Passing nil
|
||||
// here re-introduced regression #1197 in production. See
|
||||
// resolve_context_callsites_test.go.
|
||||
hopContext := []string{lowerPK}
|
||||
resolveHop := func(hop string) *nodeInfo {
|
||||
if cached, ok := hopCache[hop]; ok {
|
||||
return cached
|
||||
}
|
||||
r, _, _ := pm.resolveWithContext(hop, nil, s.store.graph)
|
||||
r, _, _ := pm.resolveWithContext(hop, hopContext, s.store.graph)
|
||||
hopCache[hop] = r
|
||||
return r
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user