зеркало из https://github.com/mozilla/gecko-dev.git
bug 767742 - close spdy sessions under total connection pressure r=honzab
--HG-- extra : rebase_source : 5fd4d2b73cf5cecfa7862d0e5bfb1354cae4797a
This commit is contained in:
Родитель
492e3d3ea7
Коммит
984c265b43
|
@ -807,7 +807,7 @@ nsHttpConnectionMgr::ProcessAllTransactionsCB(const nsACString &key,
|
|||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
// If the global number of idle connections is preventing the opening of
|
||||
// If the global number of connections is preventing the opening of
|
||||
// new connections to a host without idle connections, then
|
||||
// close them regardless of their TTL
|
||||
PLDHashOperator
|
||||
|
@ -832,6 +832,30 @@ nsHttpConnectionMgr::PurgeExcessIdleConnectionsCB(const nsACString &key,
|
|||
return PL_DHASH_STOP;
|
||||
}
|
||||
|
||||
// If the global number of connections is preventing the opening of
|
||||
// new connections to a host without idle connections, then
|
||||
// close any spdy asap
|
||||
PLDHashOperator
|
||||
nsHttpConnectionMgr::PurgeExcessSpdyConnectionsCB(const nsACString &key,
|
||||
nsAutoPtr<nsConnectionEntry> &ent,
|
||||
void *closure)
|
||||
{
|
||||
if (!ent->mUsingSpdy)
|
||||
return PL_DHASH_NEXT;
|
||||
|
||||
nsHttpConnectionMgr *self = static_cast<nsHttpConnectionMgr *>(closure);
|
||||
for (uint32_t index = 0; index < ent->mActiveConns.Length(); ++index) {
|
||||
nsHttpConnection *conn = ent->mActiveConns[index];
|
||||
if (conn->UsingSpdy() && conn->CanReuse()) {
|
||||
conn->DontReuse();
|
||||
// stop on <= (particularly =) beacuse this dontreuse causes async close
|
||||
if (self->mNumIdleConns + self->mNumActiveConns + 1 <= self->mMaxConns)
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
}
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
nsHttpConnectionMgr::PruneDeadConnectionsCB(const nsACString &key,
|
||||
nsAutoPtr<nsConnectionEntry> &ent,
|
||||
|
@ -1319,6 +1343,10 @@ nsHttpConnectionMgr::MakeNewConnection(nsConnectionEntry *ent,
|
|||
if ((mNumIdleConns + mNumActiveConns + 1 >= mMaxConns) && mNumIdleConns)
|
||||
mCT.Enumerate(PurgeExcessIdleConnectionsCB, this);
|
||||
|
||||
if ((mNumIdleConns + mNumActiveConns + 1 >= mMaxConns) &&
|
||||
mNumActiveConns && gHttpHandler->IsSpdyEnabled())
|
||||
mCT.Enumerate(PurgeExcessSpdyConnectionsCB, this);
|
||||
|
||||
if (AtActiveConnectionLimit(ent, trans->Caps()))
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
|
|
|
@ -490,6 +490,7 @@ private:
|
|||
static PLDHashOperator PruneDeadConnectionsCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
|
||||
static PLDHashOperator ShutdownPassCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
|
||||
static PLDHashOperator PurgeExcessIdleConnectionsCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
|
||||
static PLDHashOperator PurgeExcessSpdyConnectionsCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
|
||||
static PLDHashOperator ClosePersistentConnectionsCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
|
||||
bool ProcessPendingQForEntry(nsConnectionEntry *, bool considerAll);
|
||||
bool IsUnderPressure(nsConnectionEntry *ent,
|
||||
|
|
Загрузка…
Ссылка в новой задаче