Skip to content

refactor(proxy): fix race conditions with atomic types#276

Draft
LaurenceJJones wants to merge 4 commits intofosrl:devfrom
LaurenceJJones:refactor/proxy-fix-races
Draft

refactor(proxy): fix race conditions with atomic types#276
LaurenceJJones wants to merge 4 commits intofosrl:devfrom
LaurenceJJones:refactor/proxy-fix-races

Conversation

@LaurenceJJones
Copy link
Copy Markdown
Member

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

  • Change running from bool to atomic.Bool
  • Change currentTunnelID from string to atomic.Value
  • Add getTunnelID() helper for safe reads
  • Add setTunnelID() helper for safe writes
  • Add isRunning() helper for safe reads
  • Add setRunning() helper for safe writes
  • Update all usages to use the helper methods

This fixes potential race conditions where running and currentTunnelID were being read without holding the mutex in hot paths.

How to test?

- Change running from bool to atomic.Bool
- Change currentTunnelID from string to atomic.Value
- Add getTunnelID() helper for safe reads
- Add setTunnelID() helper for safe writes
- Add isRunning() helper for safe reads
- Add setRunning() helper for safe writes
- Update all usages to use the helper methods

This fixes potential race conditions where running and currentTunnelID
were being read without holding the mutex in hot paths.
refactor(proxy): capture tunnel ID per connection/flow to avoid misat…
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