summaryrefslogtreecommitdiff
path: root/src/mongo/client/connpool.cpp
diff options
context:
space:
mode:
authorEsha Maharishi <esha.maharishi@mongodb.com>2017-01-24 15:27:23 -0500
committerEsha Maharishi <esha.maharishi@mongodb.com>2017-02-06 13:51:25 -0500
commitf73b0f30be37d0093131f828aa049cf933bb4873 (patch)
treeaa5c3e717239a9ced60b4b15e9ac14291e797711 /src/mongo/client/connpool.cpp
parent78078e12c80adc6c26972eeb9eb79c28ecb2f18b (diff)
downloadmongo-f73b0f30be37d0093131f828aa049cf933bb4873.tar.gz
SERVER-27802 add comments to PoolForHost header
Diffstat (limited to 'src/mongo/client/connpool.cpp')
-rw-r--r--src/mongo/client/connpool.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/client/connpool.cpp b/src/mongo/client/connpool.cpp
index 5ef2b4e72e0..9ad9d62bb5e 100644
--- a/src/mongo/client/connpool.cpp
+++ b/src/mongo/client/connpool.cpp
@@ -216,6 +216,8 @@ DBClientBase* DBConnectionPool::_finishCreate(const string& ident,
}
DBClientBase* DBConnectionPool::get(const ConnectionString& url, double socketTimeout) {
+ // If a connection for this host is available from the underlying PoolForHost, use the
+ // connection in the pool.
DBClientBase* c = _get(url.toString(), socketTimeout);
if (c) {
try {
@@ -227,6 +229,8 @@ DBClientBase* DBConnectionPool::get(const ConnectionString& url, double socketTi
return c;
}
+ // If no connections for this host are available in the PoolForHost (that is, all the
+ // connections have been checked out, or none have been created yet), create a new connection.
string errmsg;
c = url.connect(StringData(), errmsg, socketTimeout);
uassert(13328, _name + ": connect failed " + url.toString() + " : " + errmsg, c);