Bug 1586593 - dispatch CloseInt on DataChannel Open ACK failure - r=bwc

Differential Revision: https://phabricator.services.mozilla.com/D48938

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nico Grunbaum 2019-10-11 17:03:23 +00:00
Родитель fc2f113602
Коммит 0374ef3d44
1 изменённых файлов: 11 добавлений и 6 удалений

Просмотреть файл

@ -1450,16 +1450,21 @@ void DataChannelConnection::HandleOpenRequestMessage(
channel.get()));
channel->AnnounceOpen();
int error = SendOpenAckMessage(stream);
// Note that any message can be buffered; SendOpenAckMessage may
// error later than this check.
const auto error = SendOpenAckMessage(channel->mStream);
if (error) {
DC_ERROR(("SendOpenRequest failed, error = %d", error));
// Close the channel, inform the user
CloseInt(channel);
// XXX send error via DataChannelOnMessageAvailable (bug 843625)
Dispatch(NS_NewRunnableFunction(
"DataChannelConnection::HandleOpenRequestMessage",
[channel, connection = RefPtr<DataChannelConnection>(this)]() {
MutexAutoLock mLock(connection->mLock);
// Close the channel on failure
connection->CloseInt(channel);
}));
return;
}
DeliverQueuedData(stream);
DeliverQueuedData(channel->mStream);
}
// NOTE: the updated spec from the IETF says we should set in-order until we