Skip to content

merge develop into developmod - #3

Merged
ReuschelCGN merged 2 commits into
developmodfrom
develop
Jul 24, 2026
Merged

merge develop into developmod#3
ReuschelCGN merged 2 commits into
developmodfrom
develop

Conversation

@ReuschelCGN

Copy link
Copy Markdown
Owner

No description provided.

comstud and others added 2 commits July 3, 2026 08:33
Replace the per-connection managed ping loop (EnableReadTimeout +
StartPingLoop, driven by each handler) with a single timeout goroutine
that NewConn always starts, plus a new data-packet read timeout.

libs/ws:
- PingSettings (Interval, Timeout) are held in an atomic.Pointer and a
  separate atomic read-data-timeout; WithPingSettings/WithReadDataTimeout
  options on NewConn/Accept/Dial and Set* methods apply them at runtime,
  waking the goroutine. Negative durations are rejected.
- The goroutine sends pings on the interval, and enforces the ping
  timeout (no pong OR data within Timeout) and the data timeout (no data
  within it). On expiry it stores a specific error (errReadTimeout /
  errReadDataTimeout) then expires the read deadline so a blocked Reader
  wakes and returns that error.
- Activity is read from the existing stats (LastReceivedAt/LastPongAt)
  under statsMu with ConnectedAt as the floor -- no duplicate atomics.
- Removes the bgMu/readDeadlineExt start/stop machinery; both background
  goroutines start in NewConn so Close just waits on them.

handlers:
- controller/device/worker: drop startManagedPingLoop; after registration
  clear the handshake deadline and apply ping (+ data, controller only)
  settings via a Notify watcher then the current values. Bound the
  handshake with a manual read deadline; use context.AfterFunc to expire
  the read deadline on app shutdown instead of a per-conn goroutine.

config/api/docs:
- Add controller data_timeout (*time.Duration so unset defaults to 2m
  while an explicit 0 disables it); wire through settings, /config output,
  example config, and API docs.

Tested with go test -race -count=1000 -timeout 30m ./... (clean).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ReuschelCGN
ReuschelCGN merged commit 7034c79 into developmod Jul 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants