void PoolForHost::done( DBConnectionPool * pool, DBClientBase * c ) { if (c->isFailed()) { reportBadConnectionAt(c->getSockCreationMicroSec()); pool->onDestroy(c); delete c; } else if (_pool.size() >= _maxPerHost || c->getSockCreationMicroSec() < _minValidCreationTimeMicroSec) { pool->onDestroy(c); delete c; } else { _pool.push(c); } }
void PoolForHost::done(DBConnectionPool* pool, DBClientBase* c) { bool isFailed = c->isFailed(); // Remember that this host had a broken connection for later if (isFailed) reportBadConnectionAt(c->getSockCreationMicroSec()); if (isFailed || // Another (later) connection was reported as broken to this host (c->getSockCreationMicroSec() < _minValidCreationTimeMicroSec) || // We have a pool size that we need to enforce (_maxPoolSize >= 0 && static_cast<int>(_pool.size()) >= _maxPoolSize)) { pool->onDestroy(c); delete c; } else { // The connection is probably fine, save for later _pool.push(c); } }