Commit 563b137
unbounded/backend: address Copilot review on #501
Four substantive findings + one stale comment (settings.go vpn.Init…
reference) answered via reply.
1. PatchSettings now dispatches settings.UnboundedKey to
unbounded.SetEnabled the same way it dispatches PeerShareEnabledKey
to applyPeerShare. The UI toggle now starts/stops the widget proxy
immediately rather than persisting the value and waiting for the
next NewConfigEvent.
2. Close now invokes unbounded.Stop(...) before r.cancel(). unbounded
workers run on a context.Background-derived ctx (they must outlive
any single NewConfigEvent), so without an explicit shutdown hook
the broflake widget goroutine survived backend close. Uses a fresh
5s-bounded ctx so a cancelled shutdown path doesn't skip the Stop.
3. SetEnabled now respects the full three-condition predicate before
starting. Previously it called manager.start whenever cached
*UnboundedConfig was non-nil, ignoring the cached
Features[UNBOUNDED] flag — meaning a local toggle could start the
proxy even when the server had said don't. Added lastFeatureOn to
unboundedManager (set alongside lastCfg on every NewConfigEvent)
and a shouldStart() method that re-checks all three conditions.
SetEnabled now uses shouldStart(); the standalone
shouldRunUnbounded function is removed (its job is now done by the
method).
4. unbounded.ConnectionEvent shape aligned with peer.ConnectionEvent:
{State, Source, Timestamp}. WorkerIdx is dropped from the wire
shape (it remains in the per-callback Debug log for diagnostics
but isn't part of the event contract). Doc comment updated to
spell out the field semantics. Consumers that need to pair
accept/close events for the same arc now key off Source (or
arrival sequence within a single connection's lifetime, which is
what the globe currently does).
The fifth Copilot comment cited a 'vpn.InitUnboundedSubscription'
reference in common/settings/settings.go:75 that no longer exists —
the consolidation cascade rewrote that doc to say 'the widget proxy
starts' without naming the lifecycle function. Answered in the thread
rather than re-edited.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent a286ce7 commit 563b137
2 files changed
Lines changed: 79 additions & 44 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
329 | 340 | | |
330 | 341 | | |
331 | 342 | | |
| |||
510 | 521 | | |
511 | 522 | | |
512 | 523 | | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
513 | 534 | | |
514 | 535 | | |
515 | 536 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 44 | + | |
47 | 45 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
52 | 57 | | |
53 | 58 | | |
54 | 59 | | |
55 | | - | |
56 | | - | |
| 60 | + | |
| 61 | + | |
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
62 | | - | |
63 | | - | |
64 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
65 | 82 | | |
66 | 83 | | |
67 | 84 | | |
| |||
71 | 88 | | |
72 | 89 | | |
73 | 90 | | |
74 | | - | |
75 | | - | |
76 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
77 | 95 | | |
78 | 96 | | |
79 | 97 | | |
| |||
82 | 100 | | |
83 | 101 | | |
84 | 102 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
| 103 | + | |
95 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
96 | 121 | | |
97 | 122 | | |
98 | 123 | | |
| |||
113 | 138 | | |
114 | 139 | | |
115 | 140 | | |
| 141 | + | |
| 142 | + | |
116 | 143 | | |
| 144 | + | |
117 | 145 | | |
118 | 146 | | |
119 | | - | |
120 | 147 | | |
121 | 148 | | |
122 | | - | |
| 149 | + | |
123 | 150 | | |
124 | 151 | | |
125 | 152 | | |
| |||
137 | 164 | | |
138 | 165 | | |
139 | 166 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | 167 | | |
154 | 168 | | |
155 | 169 | | |
| |||
183 | 197 | | |
184 | 198 | | |
185 | 199 | | |
186 | | - | |
| 200 | + | |
187 | 201 | | |
188 | 202 | | |
189 | | - | |
190 | | - | |
| 203 | + | |
| 204 | + | |
191 | 205 | | |
192 | 206 | | |
193 | 207 | | |
| |||
0 commit comments