Skip to content

Change activeTCPConn.close to atomic.Bool #782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2025
Merged

Conversation

cppcoffee
Copy link
Member

@cppcoffee cppcoffee commented Jun 14, 2025

Replace manual atomic operations with atomic.Bool type for better type safety and cleaner code. This modernizes the atomic usage pattern from atomic.LoadInt32/StoreInt32 to the newer Load/Store methods on atomic.Bool.

  • Update activeTCPConn.closed field type from int32 to atomic.Bool
  • Replace atomic.LoadInt32(&a.closed) with a.closed.Load()
  • Replace atomic.StoreInt32(&a.closed, 1) with a.closed.Store(true)

All existing functionality preserved with improved type safety.

Copy link

codecov bot commented Jun 14, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 78.55%. Comparing base (753c2a0) to head (ae256b8).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
active_tcp.go 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #782      +/-   ##
==========================================
+ Coverage   78.38%   78.55%   +0.16%     
==========================================
  Files          41       41              
  Lines        5441     5441              
==========================================
+ Hits         4265     4274       +9     
+ Misses        945      937       -8     
+ Partials      231      230       -1     
Flag Coverage Δ
go 78.55% <85.71%> (+0.16%) ⬆️
wasm 27.08% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Replace manual atomic operations with atomic.Bool type for better
type safety and cleaner code. This modernizes the atomic usage
pattern from atomic.LoadInt32/StoreInt32 to the newer Load/Store
methods on atomic.Bool.

- Update activeTCPConn.closed field type from int32 to atomic.Bool
- Replace atomic.LoadInt32(&a.closed) with a.closed.Load()
- Replace atomic.StoreInt32(&a.closed, 1) with a.closed.Store(true)

All existing functionality preserved with improved type safety.

Signed-off-by: Xiaobo Liu <[email protected]>

tweak

Signed-off-by: Xiaobo Liu <[email protected]>
@cppcoffee
Copy link
Member Author

cppcoffee commented Jun 14, 2025

Changed to atomic.Bool type.

@cppcoffee cppcoffee changed the title Change activeTCPConn.close to atomic.Int32 Change activeTCPConn.close to atomic.Bool Jun 14, 2025
@cppcoffee cppcoffee merged commit bbb9792 into pion:master Jun 14, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants