#1665: every agent's sync (keptaway's keeping) asks access.LANSecret.
LANSecret took mu first, which also makes and locks
caller-keys.json.lock, even when the gateway isn't shared on the LAN and
the answer is "" from settings alone. A sandbox start's lock trace
showed ~102 caller-keys.json.lock takes in its first 20s. Now the
not-shared case returns before the lock. The shared case is unchanged.
After the change, the same interposed start counted 7 opens of
caller-keys.json.lock over the run.
TestLANSecretNotSharedTakesNoLock holds mu and expects LANSecret to
return "" within 5s. Once ConfigureLAN(true, false) shares the gateway,
it expects a key. With the settings check moved back under the lock by
hand, it goes red:
--- FAIL: TestLANSecretNotSharedTakesNoLock (5.25s)
lansecret_unlocked_test.go:29: not shared, under another's lock: answered=false ""; want "" at once
What was run (worktree at 9fd80b212 plus this change and the commits
before it):
gofmt -l internal/: nothing
go vet ./internal/access: exit 0
GOOS=linux go vet -tags nogui ./...: exit 0
GOOS=windows go vet -tags nogui ./...: exit 0
go test -timeout 45m -count=1 ./internal/access: ok 21.008s