Commit fbd0df5
committed
client/conn_state_pusher: nil-receiver safe On* entry points
Fixes a panic on Engine.Stop teardown:
Engine.Stop()
e.connStatePusher.Stop()
e.connStatePusher = nil ← nilled here
...
e.removeAllPeers() ← still triggers
Conn.Close
UpdatePeerState ← fires status listener
listener-closure
e.connStatePusher. ← nil receiver
OnPeerStateChange() ← deref panic at p.events <- ev
Test_Engine_SSH on the netbirdio CI runners hit this reliably because
the runners can actually create the wg interface (sandbox cannot, so
the test fails earlier locally and never reaches the Stop path).
Stack: client/internal/conn_state_pusher.go:99 → engine.go:633 →
peer/status.go:300 (notify closure) → peer/conn.go:736 → conn.go:329
→ conn_mgr.go:454 → engine.go:864 → engine.go:852 → engine.go:391.
Defending in the pusher itself (vs. nil-checking each callsite) keeps
the engine cleanup path simple and matches the no-op-on-nil pattern
already used elsewhere in the package.1 parent 7eb350d commit fbd0df5
1 file changed
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
97 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
98 | 107 | | |
99 | 108 | | |
100 | 109 | | |
| |||
103 | 112 | | |
104 | 113 | | |
105 | 114 | | |
106 | | - | |
| 115 | + | |
| 116 | + | |
107 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
108 | 121 | | |
109 | 122 | | |
110 | 123 | | |
| |||
0 commit comments