summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/connpool.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/client/connpool.h b/client/connpool.h
index 00570c52d5b..520461a0bd7 100644
--- a/client/connpool.h
+++ b/client/connpool.h
@@ -87,8 +87,17 @@ namespace mongo {
delete c;
return;
}
- scoped_lock L(_mutex);
- _pools[host].pool.push(c);
+
+ {
+ 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 );