Bug 990984: Explicitly close socket file descriptor, r=kyle

Closing the socket explicitly will make UnixSocket fail
if we're trying to read or write afterwards; indicating
potential bugs.
This commit is contained in:
Thomas Zimmermann 2014-04-08 09:30:58 +02:00
parent 88cf1c0e54
commit cab5fcb4dd

View File

@ -64,8 +64,7 @@ public:
MOZ_ASSERT(!NS_IsMainThread());
MOZ_ASSERT(!mShuttingDownOnIOThread);
RemoveWatchers(READ_WATCHER|WRITE_WATCHER);
Close(); // will also remove fd from I/O loop
mShuttingDownOnIOThread = true;
}
@ -643,7 +642,7 @@ void
UnixSocketImpl::OnSocketCanReceiveWithoutBlocking()
{
MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop());
MOZ_ASSERT(GetConnectionStatus() == SOCKET_IS_CONNECTED);
MOZ_ASSERT(GetConnectionStatus() == SOCKET_IS_CONNECTED); // see bug 990984
// Read all of the incoming data.
while (true) {
@ -691,7 +690,7 @@ void
UnixSocketImpl::OnSocketCanSendWithoutBlocking()
{
MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop());
MOZ_ASSERT(GetConnectionStatus() == SOCKET_IS_CONNECTED);
MOZ_ASSERT(GetConnectionStatus() == SOCKET_IS_CONNECTED); // see bug 990984
// Try to write the bytes of mCurrentRilRawData. If all were written, continue.
//