Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: talk/app/webrtc/peerconnection.cc

Issue 1516943002: Reland of Free SCTP data channels asynchronously in PeerConnection. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Adding RTC_DCHECK as suggested. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/app/webrtc/peerconnection.h ('k') | talk/app/webrtc/peerconnectionendtoend_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/peerconnection.cc
diff --git a/talk/app/webrtc/peerconnection.cc b/talk/app/webrtc/peerconnection.cc
index 933dc83c25642278d49a9491c2818a57f74fd217..b8d5e05e158a1b72869f528ec5649e2d502c75b5 100644
--- a/talk/app/webrtc/peerconnection.cc
+++ b/talk/app/webrtc/peerconnection.cc
@@ -107,6 +107,7 @@ enum {
MSG_SET_SESSIONDESCRIPTION_FAILED,
MSG_CREATE_SESSIONDESCRIPTION_FAILED,
MSG_GETSTATS,
+ MSG_FREE_DATACHANNELS,
};
struct SetSessionDescriptionMsg : public rtc::MessageData {
@@ -1329,6 +1330,10 @@ void PeerConnection::OnMessage(rtc::Message* msg) {
delete param;
break;
}
+ case MSG_FREE_DATACHANNELS: {
+ sctp_data_channels_to_free_.clear();
+ break;
+ }
default:
RTC_DCHECK(false && "Not implemented");
break;
@@ -1902,13 +1907,18 @@ void PeerConnection::AllocateSctpSids(rtc::SSLRole role) {
}
void PeerConnection::OnSctpDataChannelClosed(DataChannel* channel) {
+ RTC_DCHECK(signaling_thread()->IsCurrent());
for (auto it = sctp_data_channels_.begin(); it != sctp_data_channels_.end();
++it) {
if (it->get() == channel) {
if (channel->id() >= 0) {
sid_allocator_.ReleaseSid(channel->id());
}
+ // Since this method is triggered by a signal from the DataChannel,
+ // we can't free it directly here; we need to free it asynchronously.
+ sctp_data_channels_to_free_.push_back(*it);
sctp_data_channels_.erase(it);
+ signaling_thread()->Post(this, MSG_FREE_DATACHANNELS, nullptr);
return;
}
}
« no previous file with comments | « talk/app/webrtc/peerconnection.h ('k') | talk/app/webrtc/peerconnectionendtoend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698