mirror of
https://github.com/juanfont/headscale.git
synced 2026-10-10 08:40:07 +09:00
state: report unindexed node key instead of panicking
A missing key yields the zero NodeView; its ID() panicked inside a reader goroutine and took down the test binary instead of failing with a diagnostic.
This commit is contained in:
committed by
Kristoffer Dalby
parent
85bda7c2c9
commit
541ef40c87
@@ -2449,9 +2449,14 @@ func nodeKeyIndexMismatch(snap *Snapshot) string {
|
||||
}
|
||||
|
||||
for _, nv := range snap.allNodes {
|
||||
// A missing key yields the zero view, whose ID() panics.
|
||||
got, ok := snap.nodesByNodeKey[nv.NodeKey()]
|
||||
if !ok || got.ID() != nv.ID() {
|
||||
return fmt.Sprintf("node %d: key indexed=%t id=%d", nv.ID(), ok, got.ID())
|
||||
if !ok {
|
||||
return fmt.Sprintf("node %d: key not indexed", nv.ID())
|
||||
}
|
||||
|
||||
if got.ID() != nv.ID() {
|
||||
return fmt.Sprintf("node %d: key indexed to node %d", nv.ID(), got.ID())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user