Skip to content
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

Gracefully close connecting channels #2991

Merged
merged 1 commit into from
Jan 8, 2025
Merged

Conversation

joeturki
Copy link
Member

@joeturki joeturki commented Jan 6, 2025

Description

This PR fixes an issue where calling dataChannel.Close on 'connecting' state channels didn't work as expected; It adds the ability to reject data channels directly from the OnDataConnection handler.

Reference issue

Fixes #2659

Copy link

codecov bot commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 77.89%. Comparing base (1ee0299) to head (275ed7b).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
datachannel.go 50.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2991      +/-   ##
==========================================
- Coverage   77.93%   77.89%   -0.04%     
==========================================
  Files          89       89              
  Lines       10546    10550       +4     
==========================================
- Hits         8219     8218       -1     
- Misses       1838     1841       +3     
- Partials      489      491       +2     
Flag Coverage Δ
go 79.46% <50.00%> (-0.05%) ⬇️
wasm 63.50% <ø> (ø)

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.

@joeturki joeturki force-pushed the fix/close-connecting-channels branch 2 times, most recently from 4e15fac to 7870657 Compare January 6, 2025 05:25
@joeturki joeturki marked this pull request as draft January 6, 2025 05:54
@joeturki joeturki force-pushed the fix/close-connecting-channels branch from 7870657 to d3b26cb Compare January 6, 2025 06:00
@joeturki joeturki marked this pull request as ready for review January 6, 2025 06:06
@joeturki joeturki force-pushed the fix/close-connecting-channels branch from d3b26cb to f647518 Compare January 6, 2025 06:09
datachannel.go Outdated
d.mu.Unlock()
dc.Close() // nolint:errcheck,gosec
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a comment is required here, since it's not immediately obvious why that is needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fixing and merging that right now actually! I am going to log the error.

Also going to get involved with RTX, sorry I have been busy.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, I'm going to implement TWCC, and come back to RTX when you guys are ready.

Copy link
Member Author

@joeturki joeturki Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used to log the error but I removed it in another commit my bad :)

@Sean-Der Sean-Der force-pushed the fix/close-connecting-channels branch from f647518 to 032e3eb Compare January 8, 2025 14:51
Fixes an issue where calling dataChannel.Close on
'connecting' state channels didn't work as expected.
When handling the `OnOpen` event detect if the
user has requested close.

Fixes #2659
@Sean-Der Sean-Der force-pushed the fix/close-connecting-channels branch from 032e3eb to 275ed7b Compare January 8, 2025 14:52
Copy link
Member

@Sean-Der Sean-Der left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work @joeturki congrats on the first merge 🥳

@Sean-Der Sean-Der merged commit c895252 into master Jan 8, 2025
16 checks passed
@Sean-Der Sean-Der deleted the fix/close-connecting-channels branch January 8, 2025 14:57
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.

Data channel does not close if dataChannel.Close is called in the OnDataChannel handler
3 participants