Adds fix for closing a prenegotiated DC without sending data.

Also adds tests.

Bug: webrtc:11628
Change-Id: If29cdcdf055a95c488b3db4387d29f6f958bf9a3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176326
Reviewed-by: Taylor <deadbeef@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31412}
This commit is contained in:
Harald Alvestrand 2020-06-02 10:46:12 +02:00 committed by Commit Bot
parent a6c70741e7
commit 3c9ae1fd8f
2 changed files with 12 additions and 0 deletions

View File

@ -1182,6 +1182,9 @@ void SctpTransport::OnNotificationAssocChange(const sctp_assoc_change& change) {
max_outbound_streams_ = change.sac_outbound_streams;
max_inbound_streams_ = change.sac_inbound_streams;
SignalAssociationChangeCommunicationUp();
// In case someone tried to close a stream before communication
// came up, send any queued resets.
SendQueuedStreamResets();
break;
case SCTP_COMM_LOST:
RTC_LOG(LS_INFO) << "Association change SCTP_COMM_LOST";

View File

@ -605,6 +605,15 @@ TEST_F(SctpTransportTest, ClosesRemoteStream) {
transport1()->ResetStream(1);
EXPECT_TRUE_WAIT(transport2_observer.WasStreamClosed(1), kDefaultTimeout);
}
TEST_F(SctpTransportTest, ClosesRemoteStreamWithNoData) {
SetupConnectedTransportsWithTwoStreams();
SctpTransportObserver transport1_observer(transport1());
SctpTransportObserver transport2_observer(transport2());
// Close stream 1 on transport 1. Transport 2 should notify us.
transport1()->ResetStream(1);
EXPECT_TRUE_WAIT(transport2_observer.WasStreamClosed(1), kDefaultTimeout);
}
TEST_F(SctpTransportTest, ClosesTwoRemoteStreams) {
SetupConnectedTransportsWithTwoStreams();