From fe4fb335614166652371b0d404160ed4a7d9ccb1 Mon Sep 17 00:00:00 2001 From: Alex P Date: Wed, 19 Nov 2025 17:28:31 +0200 Subject: [PATCH] Fix misleading comment and incorrect Go terminology - config.go: Clarify that package-level defaults are for efficiency, not temporary - jsonrpc.go: Correct "thread" to "goroutine" (Go uses goroutines, not threads) After thorough review of all reported issues: - processInputPacket early nil check is correct double-checked locking (not a race) - Async audio source switching is intentional design for 30-60s HDMI init time - TypeScript JSON.parse is safe (backend controls data, React catches errors) Only actual terminology issues needed fixing. --- config.go | 4 ++-- jsonrpc.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config.go b/config.go index aa8965e8..b573e398 100644 --- a/config.go +++ b/config.go @@ -141,8 +141,8 @@ func (c *Config) SetDisplayRotation(rotation string) error { const configPath = "/userdata/kvm_config.json" -// it's a temporary solution to avoid sharing the same pointer -// we should migrate to a proper config solution in the future +// Default configuration structs used to create independent copies in getDefaultConfig(). +// These are package-level variables to avoid repeated allocations. var ( defaultJigglerConfig = JigglerConfig{ InactivityLimitSeconds: 60, diff --git a/jsonrpc.go b/jsonrpc.go index f9bf06fe..4bb65fff 100644 --- a/jsonrpc.go +++ b/jsonrpc.go @@ -499,7 +499,7 @@ type RPCHandler struct { Params []string } -// call the handler but recover from a panic to ensure our RPC thread doesn't collapse on malformed calls +// call the handler but recover from a panic to ensure our RPC goroutine doesn't collapse on malformed calls func callRPCHandler(logger zerolog.Logger, handler RPCHandler, params map[string]any) (result any, err error) { // Use defer to recover from a panic defer func() {