-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Drop reference to detached datachannels #2696
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2696 +/- ##
=======================================
Coverage 76.38% 76.39%
=======================================
Files 87 87
Lines 9923 9947 +24
=======================================
+ Hits 7580 7599 +19
- Misses 1871 1875 +4
- Partials 472 473 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
e2efe0a
to
2268938
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me. Thanks @sukunrt!
d.sctpTransport.lock.Lock() | ||
n := len(d.sctpTransport.dataChannels) | ||
j := 0 | ||
for i := 0; i < n; i++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does d.sctpTransport.dataChannels
need to remain in order? Can you swap remove instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I can. I just didn't want to change that property here.
Thank you so much @sukunrt! Really appreciate the tests :) Rebasing + merging now |
2268938
to
dff6bcb
Compare
This allows users of detached datachannels to garbage collect resources associated with the datachannel and the sctp stream. There is no functional change here.
dff6bcb
to
2444e36
Compare
#2696 introduced removing datachannels from the sctptransport for better garbage collection. That PR introduced a race condition for data channels created before connection establishment. When an out of band negotiated data channel, created before peerconnection establishment is detached, there's a race between the data channel being removed from `r.dataChannels` and it being copied in to the existing data channel slice in the acceptDataChannels goroutine. This PR fixes this race by copying the slice before any datachannels could be detached.
#2696 introduced removing datachannels from the sctptransport for better garbage collection. That PR introduced a race condition for data channels created before connection establishment. When an out of band negotiated data channel, created before peerconnection establishment is detached, there's a race between the data channel being removed from `r.dataChannels` and it being copied in to the existing data channel slice in the acceptDataChannels goroutine. This PR fixes this race by copying the slice before any datachannels could be detached.
#2696 introduced removing datachannels from the sctptransport for better garbage collection. That PR introduced a race condition for data channels created before connection establishment. When an out of band negotiated data channel, created before peerconnection establishment is detached, there's a race between the data channel being removed from `r.dataChannels` and it being copied in to the existing data channel slice in the acceptDataChannels goroutine. This PR fixes this race by copying the slice before any datachannels could be detached.
#2696 introduced removing datachannels from the sctptransport for better garbage collection. That PR introduced a race condition for data channels created before connection establishment. When an out of band negotiated data channel, created before peerconnection establishment is detached, there's a race between the data channel being removed from `r.dataChannels` and it being copied in to the existing data channel slice in the acceptDataChannels goroutine. This PR fixes this race by copying the slice before any datachannels could be detached.
This allows users of detached datachannels to garbage collect resources associated with the datachannel and the sctp stream. There is no functional change here.
Fixes #2672