cap connection pool size

This commit is contained in:
Eliot Horowitz 2011-03-05 21:30:37 -05:00
parent 3047651c7f
commit ca84e8ebf7
1 changed files with 11 additions and 2 deletions

View File

@ -87,8 +87,17 @@ namespace mongo {
delete c;
return;
}
{
scoped_lock L(_mutex);
if ( _pools[host].pool.size() < 50 ) {
_pools[host].pool.push(c);
return;
}
}
// if we get here it means we didn't add for some reason
delete c;
}
void addHook( DBConnectionHook * hook );
void appendInfo( BSONObjBuilder& b );