Make it safe to close an IPC channel that has already been closed by its remote endpoint. (bug 1314816 part 2, r=billm)

This commit is contained in:
David Anderson 2016-11-04 18:31:30 -07:00
Родитель a2d3e4e9f2
Коммит fa968bf690
1 изменённых файлов: 7 добавлений и 3 удалений

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

@ -2265,14 +2265,18 @@ MessageChannel::Close()
return;
}
if (ChannelConnected != mChannelState) {
if (ChannelClosed == mChannelState) {
// XXX be strict about this until there's a compelling reason
// to relax
NS_RUNTIMEABORT("Close() called on closed channel!");
}
// notify the other side that we're about to close our socket
mLink->SendMessage(new GoodbyeMessage());
// Notify the other side that we're about to close our socket. If we've
// already received a Goodbye from the other side (and our state is
// ChannelClosing), there's no reason to send one.
if (ChannelConnected == mChannelState) {
mLink->SendMessage(new GoodbyeMessage());
}
SynchronouslyClose();
}