From b364016cbb7cf8f7050932bcd2b2ee5c9e600dbd Mon Sep 17 00:00:00 2001 From: "jiayl@webrtc.org" Date: Wed, 28 May 2014 16:37:25 +0000 Subject: [PATCH] Revert r6161 "Drop the DataChannel message if it's received when the channel is not open." The spec does not say the DataChannel has to be open to receive a message. TBR=pthatcher@google.com BUG=crbug/363005 Review URL: https://webrtc-codereview.appspot.com/16569004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6264 4adac7df-926f-26a2-2b94-8c16560cd09d --- talk/app/webrtc/datachannel.cc | 4 ---- talk/app/webrtc/datachannel_unittest.cc | 13 ------------- 2 files changed, 17 deletions(-) diff --git a/talk/app/webrtc/datachannel.cc b/talk/app/webrtc/datachannel.cc index db3e1575e0..048e89a505 100644 --- a/talk/app/webrtc/datachannel.cc +++ b/talk/app/webrtc/datachannel.cc @@ -284,10 +284,6 @@ void DataChannel::OnDataEngineClose() { void DataChannel::OnDataReceived(cricket::DataChannel* channel, const cricket::ReceiveDataParams& params, const talk_base::Buffer& payload) { - if (state_ != kOpen) { - return; - } - uint32 expected_ssrc = (data_channel_type_ == cricket::DCT_RTP) ? receive_ssrc_ : config_.id; if (params.ssrc != expected_ssrc) { diff --git a/talk/app/webrtc/datachannel_unittest.cc b/talk/app/webrtc/datachannel_unittest.cc index 4406b9a241..1be24e96ce 100644 --- a/talk/app/webrtc/datachannel_unittest.cc +++ b/talk/app/webrtc/datachannel_unittest.cc @@ -302,16 +302,3 @@ TEST_F(SctpDataChannelTest, OpenAckRoleInitialization) { webrtc::InternalDataChannelInit init2(base); EXPECT_EQ(webrtc::InternalDataChannelInit::kNone, init2.open_handshake_role); } - -// Tests that message is dropped if the channel is not open. -TEST_F(SctpDataChannelTest, ReceivedDataDroppedIfNotOpen) { - AddObserver(); - EXPECT_CALL(*(observer_.get()), OnMessage(testing::_)).Times(0); - - webrtc_data_channel_->SetSctpSid(1); - - cricket::ReceiveDataParams params; - params.ssrc = 1; - webrtc::DataBuffer buffer("abcd"); - webrtc_data_channel_->OnDataReceived(NULL, params, buffer.data); -}