diff --git a/pc/data_channel.cc b/pc/data_channel.cc index 4f871b4d50..0b9af37544 100644 --- a/pc/data_channel.cc +++ b/pc/data_channel.cc @@ -370,10 +370,10 @@ void DataChannel::OnTransportChannelClosed() { // The SctpTransport is unusable (for example, because the SCTP m= section // was rejected, or because the DTLS transport closed), so we need to close // abruptly. - // Note: this needs to differentiate between normal close and error close. - // https://w3c.github.io/webrtc-pc/#announcing-a-data-channel-as-closed - CloseAbruptlyWithError( - RTCError(RTCErrorType::NETWORK_ERROR, "Transport channel closed")); + RTCError error = RTCError(RTCErrorType::OPERATION_ERROR_WITH_DATA, + "Transport channel closed"); + error.set_error_detail(RTCErrorDetailType::SCTP_FAILURE); + CloseAbruptlyWithError(std::move(error)); } // The remote peer request that this channel shall be closed. diff --git a/pc/data_channel_unittest.cc b/pc/data_channel_unittest.cc index 6bb8f7e5c7..b29be338cb 100644 --- a/pc/data_channel_unittest.cc +++ b/pc/data_channel_unittest.cc @@ -630,9 +630,9 @@ TEST_F(SctpDataChannelTest, TransportDestroyedWhileDataBuffered) { EXPECT_EQ_WAIT(webrtc::DataChannelInterface::kClosed, webrtc_data_channel_->state(), kDefaultTimeout); EXPECT_FALSE(webrtc_data_channel_->error().ok()); - EXPECT_EQ(webrtc::RTCErrorType::NETWORK_ERROR, + EXPECT_EQ(webrtc::RTCErrorType::OPERATION_ERROR_WITH_DATA, webrtc_data_channel_->error().type()); - EXPECT_EQ(webrtc::RTCErrorDetailType::NONE, + EXPECT_EQ(webrtc::RTCErrorDetailType::SCTP_FAILURE, webrtc_data_channel_->error().error_detail()); }