mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
91429; Restrict open connections to max connections
bug 91429 r=bbaetz sr=darin
This commit is contained in:
parent
9ba80f9e06
commit
f14e77e640
@ -736,6 +736,17 @@ nsHttpHandler::GetConnection_Locked(nsHttpConnectionInfo *ci,
|
||||
NS_RELEASE(conn);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// We created a new connection
|
||||
// If idle + active connections > max connections, then purge the oldest idle one.
|
||||
if (mIdleConnections.Count() + mActiveConnections.Count() > mMaxConnections) {
|
||||
NS_ASSERTION(mIdleConnections.Count() > 0, "idle connection list is empty");
|
||||
if (mIdleConnections.Count() > 0) {
|
||||
nsHttpConnection *conn = (nsHttpConnection *) mIdleConnections[0];
|
||||
mIdleConnections.RemoveElement(0);
|
||||
NS_RELEASE(conn);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Update the connectionInfo (bug 94038)
|
||||
|
Loading…
Reference in New Issue
Block a user