Skip to content

tor: bind final SOCKS listener before publishing port (ENV-3071) - #81

Open
Jacksper13 wants to merge 1 commit into
agent/env-3039-stop-client-teardownfrom
jack/env-3071-socks-bind-race
Open

tor: bind final SOCKS listener before publishing port (ENV-3071)#81
Jacksper13 wants to merge 1 commit into
agent/env-3039-stop-client-teardownfrom
jack/env-3071-socks-bind-race

Conversation

@Jacksper13

Copy link
Copy Markdown
Contributor

Problem

Dart reserved an ephemeral SOCKS port, closed the reservation, and then asked Rust to bind it. Another local process could claim that port during the handoff, and Envoy could report a port it did not own.

Changes

  • let the final native listener select an ephemeral loopback port
  • retain that listener before returning the actual bound port
  • fail startup when an explicitly requested port is already owned
  • add regression coverage for both ownership paths

Validation

  • cargo fmt --check
  • cargo test --locked (4 passed)
  • dart format --set-exit-if-changed lib/tor.dart
  • flutter analyze --no-pub lib/tor.dart

Stacked on #79 because it uses the synchronous listener startup introduced there. Tracks ENV-3071.

Remove the reserve-close-rebind handoff from Dart. Let the native proxy select and retain its ephemeral listener, return the actual bound port, and fail closed if a requested port is already owned.
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