Skip to content

fix(receiver): guard idle watchdog clock underflow - #173

Closed
Betafer wants to merge 1 commit into
swellweb:maint-3.5from
Betafer:codex/fix-receiver-watchdog-clock-v3.5
Closed

Betafer wants to merge 1 commit into
swellweb:maint-3.5from
Betafer:codex/fix-receiver-watchdog-clock-v3.5

Conversation

@Betafer

@Betafer Betafer commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix the unsigned idle-watchdog underflow reported in #156, where a short timestamp reversal is interpreted as nearly UINT64_MAX milliseconds and disconnects a healthy session.

The elapsed-time calculation is moved into a small testable helper. When the current monotonic value is lower than the saved activity timestamp, the watchdog rebases the timestamp instead of expiring the connection.

The receive path also refreshes last activity from a new monotonic reading after data is drained, so both values used by the watchdog come from the same clock source.

Scope

  • isolated watchdog helper and tests
  • no protocol or timeout changes
  • normal ten-second stale-session cleanup is preserved

Verification

  • rebased onto maint-3.5 at v3.5.1-rc.3
  • 12 focused watchdog checks cover normal, exact-timeout and 52 ms backward-jump cases
  • Receiver make test: 654 total checks; all pass
  • full Receiver build succeeds

Closes #156.

@swellweb

swellweb commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Thanks @Betafer for this contribution! Integrated into maint-3.5 through #191, with original author credit preserved. The integration passed Sender/Receiver CI on Intel and Apple Silicon, targeted tests and live testing. Closing this PR as incorporated; the fixes are included in the upcoming 3.5.1 maintenance release.

@swellweb swellweb closed this Sep 5, 2026
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