91429; Restrict open connections to max connections

bug 91429 r=bbaetz sr=darin
This commit is contained in:
badami%netscape.com 2002-02-13 05:34:08 +00:00
parent 9ba80f9e06
commit f14e77e640

View File

@ -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)