Bug 840294: Check RIL validity before writing to socket; r=tzimmerman

--HG--
extra : rebase_source : 3fd48cad8cd3b06994972f420752c5676b2e68dc
This commit is contained in:
Kyle Machulis 2013-02-21 15:21:34 -08:00
parent a133579459
commit 2fc57b1b3a
2 changed files with 4 additions and 1 deletions

View File

@ -449,7 +449,8 @@ SystemWorkerManager::SendRilRawData(unsigned long aClientId,
UnixSocketRawData* aRaw)
{
if ((gInstance->mRilConsumers.Length() <= aClientId) ||
!gInstance->mRilConsumers[aClientId]) {
!gInstance->mRilConsumers[aClientId] ||
gInstance->mRilConsumers[aClientId]->GetConnectionStatus() != SOCKET_CONNECTED) {
// Probably shuting down.
delete aRaw;
return true;

View File

@ -115,6 +115,7 @@ public:
void SetUpIO()
{
MOZ_ASSERT(!mIOLoop);
MOZ_ASSERT(mFd >= 0);
mIOLoop = MessageLoopForIO::current();
mIOLoop->WatchFileDescriptor(mFd,
true,
@ -749,6 +750,7 @@ UnixSocketImpl::OnFileCanWriteWithoutBlocking(int aFd)
// within mCurrentRilRawData, and request another write when the
// system won't block.
//
MOZ_ASSERT(aFd >= 0);
while (true) {
UnixSocketRawData* data;
if (mOutgoingQ.IsEmpty()) {