Revert "Don't crash when a datachannel can't get an ID"

This reverts commit 77c442ca1946924b0acfc9c0ba469ef6a2c3178f.

Reason for revert: Breakage on internal build tests, random breakage elsewhere. Timing issues suspected.

Original change's description:
> Don't crash when a datachannel can't get an ID
> 
> This is exercised by WPT test RTCDataChannel-id.
> 
> Bug: chromium:945256
> Change-Id: I53781dc874134f8c68a49c201848377b93b8858f
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128871
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Reviewed-by: Seth Hampson <shampson@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#27300}

TBR=hbos@webrtc.org,hta@webrtc.org,shampson@webrtc.org

Change-Id: Ib7eaf8880e8ce21226b84b3b2283be93acb8dc8b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:945256
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/129766
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27302}
This commit is contained in:
Harald Alvestrand
2019-03-27 07:23:31 +00:00
committed by Commit Bot
parent cf8df397c5
commit b9bb3718e3
2 changed files with 1 additions and 17 deletions

View File

@ -414,10 +414,7 @@ void DataChannel::OnChannelReady(bool writable) {
if (!writable) { if (!writable) {
return; return;
} }
// If the datachannel has not been assigned an ID, ignore update.
if (id() < 0) {
return;
}
SendQueuedControlMessages(); SendQueuedControlMessages();
SendQueuedDataMessages(); SendQueuedDataMessages();
UpdateState(); UpdateState();

View File

@ -613,19 +613,6 @@ TEST_F(SctpDataChannelTest, TransportDestroyedWhileDataBuffered) {
webrtc_data_channel_->state(), kDefaultTimeout); webrtc_data_channel_->state(), kDefaultTimeout);
} }
// Verifies that if the allocator is exhausted before connecting, the
// datachannel does not cause a crash, but remains unconnected.
TEST_F(SctpDataChannelTest, NoCrashAfterTransportBecomesAvailable) {
// This is the same as SetChannelReady, but without setting the id.
provider_->set_transport_available(true);
webrtc_data_channel_->OnTransportChannelCreated();
provider_->set_ready_to_send(true);
// The datachannel's ID is not set, and it remains in "connecting" state.
EXPECT_EQ(-1, webrtc_data_channel_->id());
EXPECT_EQ(webrtc::DataChannelInterface::kConnecting,
webrtc_data_channel_->state());
}
class SctpSidAllocatorTest : public testing::Test { class SctpSidAllocatorTest : public testing::Test {
protected: protected:
SctpSidAllocator allocator_; SctpSidAllocator allocator_;