Skip to content

feat: return exact timestamp when next action is required#213

Merged
thomaseizinger merged 3 commits into
masterfrom
claude/boringtun-pr61-rebase-tests-0ezrda
Jul 14, 2026
Merged

feat: return exact timestamp when next action is required#213
thomaseizinger merged 3 commits into
masterfrom
claude/boringtun-pr61-rebase-tests-0ezrda

Conversation

@thomaseizinger

@thomaseizinger thomaseizinger commented Jul 14, 2026

Copy link
Copy Markdown
Member

next_timer_update now reports the exact instant of the next required action (and the reason for it) rather than an approximation, so callers can drive the tunnel purely off the returned instant instead of polling once a second. The timer test suite is updated to do exactly that, which doubles as an assertion that the reported instants are complete: polling only at them reproduces the once-a-second behaviour.

This allows callers to properly suspend until the next event instead of having to wake up once a second to update boringtun's timers.

claude added 3 commits July 14, 2026 04:04
Extract each timer into a method on `Timers` that returns the exact
`Instant` at which it is due, and use them to make `next_timer_update`
report the precise next wake-up together with a reason for it. Callers
can now drive the state machine purely by polling at the returned
instant instead of on a fixed interval.

`clear_all` now takes the current time instead of reading the wall
clock, keeping the timer state pure so the reported instants stay
deterministic after a connection is wiped.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XsRkNsA4r812CDfwPH8ehF
`Sim::advance` no longer polls once per tick. It jumps straight to the
earliest instant either peer announces via `next_timer_update`, which
asserts that the announced instants are complete: polling only at them
reproduces the exact behaviour of polling once a second. A small nudge
keeps forward progress across the strictly-after session-expiry boundary.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XsRkNsA4r812CDfwPH8ehF
Cover the guarantee restored in #104: sending on a session older than
REKEY_AFTER_TIME arms a timer whose deadline has already elapsed, and
`next_timer_update` must clamp that to the last known now rather than
hand the caller an instant it can never sleep until. The jump-based
harness clamps its own step, so this contract was otherwise untested.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XsRkNsA4r812CDfwPH8ehF
@thomaseizinger thomaseizinger requested a review from jamilbk July 14, 2026 05:12
@thomaseizinger thomaseizinger enabled auto-merge July 14, 2026 05:12
@thomaseizinger thomaseizinger added this pull request to the merge queue Jul 14, 2026
Merged via the queue into master with commit 268e4c6 Jul 14, 2026
17 checks passed
thomaseizinger pushed a commit to firezone/firezone that referenced this pull request Jul 14, 2026
boringtun's `next_timer_update` now reports the exact instant of the next
required timer action, so the tunnel no longer needs polling on a fixed
one-second interval. Bump boringtun to pick that up and query it directly
when computing the next timeout.

Related: firezone/boringtun#213

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XsRkNsA4r812CDfwPH8ehF
thomaseizinger pushed a commit to firezone/firezone that referenced this pull request Jul 14, 2026
boringtun's `next_timer_update` now reports the exact instant of the next
required timer action, so the tunnel no longer needs polling on a fixed
one-second interval. Bump boringtun to pick that up and query it directly
when computing the next timeout.

Related: firezone/boringtun#213

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XsRkNsA4r812CDfwPH8ehF
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.

3 participants