bug 738812 timer serviced after thread exit nsHttpConnectionMgr::ReadTimeoutTick r=honzab

This commit is contained in:
Patrick McManus 2012-04-11 13:11:09 -04:00
parent bcb3205189
commit c1a33ecaf0
2 changed files with 26 additions and 6 deletions

View File

@ -254,6 +254,24 @@ nsHttpConnectionMgr::ConditionallyStopPruneDeadConnectionsTimer()
}
}
void
nsHttpConnectionMgr::ConditionallyStopReadTimeoutTick()
{
LOG(("nsHttpConnectionMgr::ConditionallyStopReadTimeoutTick "
"armed=%d active=%d\n", mReadTimeoutTickArmed, mNumActiveConns));
if (!mReadTimeoutTickArmed)
return;
if (mNumActiveConns)
return;
LOG(("nsHttpConnectionMgr::ConditionallyStopReadTimeoutTick stop==true\n"));
mReadTimeoutTick->Cancel();
mReadTimeoutTickArmed = false;
}
//-----------------------------------------------------------------------------
// nsHttpConnectionMgr::nsIObserver
//-----------------------------------------------------------------------------
@ -1458,6 +1476,8 @@ nsHttpConnectionMgr::DispatchTransaction(nsConnectionEntry *ent,
if (conn == ent->mYellowConnection)
ent->OnYellowComplete();
mNumActiveConns--;
ConditionallyStopReadTimeoutTick();
// sever back references to connection, and do so without triggering
// a call to ReclaimConnection ;-)
pipeline->SetConnection(nsnull);
@ -1589,6 +1609,7 @@ void
nsHttpConnectionMgr::RecvdConnect()
{
mNumActiveConns--;
ConditionallyStopReadTimeoutTick();
}
nsresult
@ -1868,6 +1889,7 @@ nsHttpConnectionMgr::OnMsgReclaimConnection(PRInt32, void *param)
nsHttpConnection *temp = conn;
NS_RELEASE(temp);
mNumActiveConns--;
ConditionallyStopReadTimeoutTick();
}
if (conn->CanReuse()) {
@ -2001,12 +2023,6 @@ nsHttpConnectionMgr::ReadTimeoutTick()
LOG(("nsHttpConnectionMgr::ReadTimeoutTick active=%d\n",
mNumActiveConns));
if (!mNumActiveConns && mReadTimeoutTickArmed) {
mReadTimeoutTick->Cancel();
mReadTimeoutTickArmed = false;
return;
}
mCT.Enumerate(ReadTimeoutTickCB, this);
}

View File

@ -105,6 +105,10 @@ public:
// there are no more idle connections or active spdy ones
void ConditionallyStopPruneDeadConnectionsTimer();
// Stops timer used for the read timeout tick if there are no currently
// active connections.
void ConditionallyStopReadTimeoutTick();
// adds a transaction to the list of managed transactions.
nsresult AddTransaction(nsHttpTransaction *, PRInt32 priority);