Bug 1118398 - Dispatch data channel onclose unconditionally on reset, r=jesup
--- a/netwerk/sctp/datachannel/DataChannel.cpp
+++ b/netwerk/sctp/datachannel/DataChannel.cpp
@@ -1761,36 +1761,36 @@ DataChannelConnection::HandleStreamReset
LOG(("Incoming: Channel %u closed, state %d",
channel->mStream, channel->mState));
ASSERT_WEBRTC(channel->mState == DataChannel::OPEN ||
channel->mState == DataChannel::CLOSING ||
channel->mState == DataChannel::CONNECTING ||
channel->mState == DataChannel::WAITING_TO_OPEN);
if (channel->mState == DataChannel::OPEN ||
channel->mState == DataChannel::WAITING_TO_OPEN) {
+ // Mark the stream for reset (the reset is sent below)
ResetOutgoingStream(channel->mStream);
- SendOutgoingStreamReset();
- NS_DispatchToMainThread(new DataChannelOnMessageAvailable(
- DataChannelOnMessageAvailable::ON_CHANNEL_CLOSED, this,
- channel));
}
+ NS_DispatchToMainThread(new DataChannelOnMessageAvailable(
+ DataChannelOnMessageAvailable::ON_CHANNEL_CLOSED, this,
+ channel));
mStreams[channel->mStream] = nullptr;
LOG(("Disconnected DataChannel %p from connection %p",
(void *) channel.get(), (void *) channel->mConnection.get()));
channel->Destroy();
// At this point when we leave here, the object is a zombie held alive only by the DOM object
} else {
LOG(("Can't find incoming channel %d",i));
}
}
}
}
- // In case we failed to send a RESET due to having one outstanding, process any pending resets now:
+ // Process any pending resets now:
if (!mStreamsResetting.IsEmpty()) {
LOG(("Sending %d pending resets", mStreamsResetting.Length()));
SendOutgoingStreamReset();
}
}
void
DataChannelConnection::HandleStreamChangeEvent(const struct sctp_stream_change_event *strchg)