headscale/hscontrol/state
Kristoffer Dalby 7706552c99 state: gate reconnect PolicyChange on NodeNeedsPeerRecompute
Connect and Disconnect appended change.PolicyChange() on every reconnect. PolicyChange sets RequiresRuntimePeerComputation, so the batcher rebuilt a full netmap (packet filters, SSH policy, peer serialization) for every connected node — O(N) per reconnect, O(N^2) on a restart storm. On a small VM this saturated CPU after the v0.28 -> v0.29 upgrade.

Emit it only when the node's online state changes what peers compute: subnet routers, relay targets, and via targets. An ordinary reconnect now sends just the lightweight online/offline peer patch. Relay and via targets still recompute, so peers drop a stale PeerRelay allocation when a relay goes offline.

Fixes #3293
2026-06-03 14:51:57 +02:00
..
auth_cache_test.go state: replace zcache with bounded LRU for auth cache 2026-04-10 14:09:57 +01:00
connect_test.go state: gate reconnect PolicyChange on NodeNeedsPeerRecompute 2026-06-03 14:51:57 +02:00
debug.go all: apply godoc [Name] link conventions across comments 2026-05-19 09:55:22 +02:00
debug_test.go hscontrol/state: make NodeStore batch configuration tunable (#2886) 2025-11-28 16:38:29 +01:00
endpoint_test.go hscontrol/state: make NodeStore batch configuration tunable (#2886) 2025-11-28 16:38:29 +01:00
ephemeral_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
ha_health.go all: apply godoc [Name] link conventions across comments 2026-05-19 09:55:22 +02:00
maprequest.go all: apply godoc [Name] link conventions across comments 2026-05-19 09:55:22 +02:00
maprequest_test.go all: apply godoc [Name] link conventions across comments 2026-05-19 09:55:22 +02:00
node_store.go all: apply godoc [Name] link conventions across comments 2026-05-19 09:55:22 +02:00
node_store_hostname_test.go state: auto-bump GivenName on collision and add SetGivenName 2026-04-18 15:12:21 +01:00
node_store_test.go types: persist Node JSON slices via named IsZero types 2026-05-15 11:21:58 +02:00
persist_test.go state: add regression test for Node slice persistence 2026-05-15 11:21:58 +02:00
ping.go all: apply godoc [Name] link conventions across comments 2026-05-19 09:55:22 +02:00
ping_test.go state: drain pending pings on Close 2026-04-17 16:31:49 +01:00
primaries_property_test.go state, servertest: property-test HA election + invariant catalogue 2026-05-18 17:18:08 +02:00
primaries_test.go state, servertest: property-test HA election + invariant catalogue 2026-05-18 17:18:08 +02:00
ssh_check_test.go state, policy, noise: implement SSH check period auto-approval 2026-02-25 21:28:05 +01:00
state.go state: gate reconnect PolicyChange on NodeNeedsPeerRecompute 2026-06-03 14:51:57 +02:00
tags.go all: apply godoc [Name] link conventions across comments 2026-05-19 09:55:22 +02:00
test_helpers.go all: apply godoc [Name] link conventions across comments 2026-05-19 09:55:22 +02:00