Index: webrtc/api/datachannel.cc |
diff --git a/webrtc/api/datachannel.cc b/webrtc/api/datachannel.cc |
index 5bffa03ce96db05c16cf3a99b1c3a7e1c4736793..6b13bf2c705ae7152c9ce4fa6edef00f9ce92340 100644 |
--- a/webrtc/api/datachannel.cc |
+++ b/webrtc/api/datachannel.cc |
@@ -297,10 +297,11 @@ void DataChannel::OnTransportChannelCreated() { |
} |
} |
-// The underlying transport channel was destroyed. |
-// This function makes sure the DataChannel is disconnected and changes state to |
-// kClosed. |
void DataChannel::OnTransportChannelDestroyed() { |
+ // This method needs to synchronously close the data channel, which means any |
+ // queued data needs to be discarded. |
+ queued_send_data_.Clear(); |
+ queued_control_data_.Clear(); |
DoClose(); |
} |