Skip to content

tor: serialize lifecycle transitions (ENV-3072) - #82

Open
Jacksper13 wants to merge 2 commits into
jack/env-3071-socks-bind-racefrom
jack/env-3072-serialize-tor-lifecycle
Open

tor: serialize lifecycle transitions (ENV-3072)#82
Jacksper13 wants to merge 2 commits into
jack/env-3071-socks-bind-racefrom
jack/env-3072-serialize-tor-lifecycle

Conversation

@Jacksper13

Copy link
Copy Markdown
Contributor

Problem

Tor lifecycle calls can overlap. A stop issued while start is bootstrapping can return before that stale start publishes a live SOCKS proxy, and bootstrap can similarly restore readiness after teardown.

Changes

  • serialize start, bootstrap, and stop operations
  • invalidate in-flight generations as soon as stop is requested
  • tear down resources returned by a superseded start instead of publishing them
  • stop publishing the route before native teardown begins
  • add deterministic ordering and invalidation regression tests

Stack

This is stacked on #81 so it builds on the final listener ownership and deterministic teardown introduced by #79 and #81. Only this PR's lifecycle changes are shown against that base.

Validation

  • flutter test test/tor_lifecycle_gate_test.dart
  • flutter analyze --no-pub lib/tor.dart lib/src/tor_lifecycle_gate.dart test/tor_lifecycle_gate_test.dart
  • dart format
  • git diff --check

Tracks ENV-3072.

@Jacksper13
Jacksper13 requested a review from InvertedX August 28, 2026 10:26
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.

1 participant