in squangle/mysql_client/AsyncConnectionPool.cpp [866:900]
void ConnectPoolOperation::specializedRunImpl() {
// Initialize all we need from our tevent handler
if (attempts_made_ == 0) {
conn()->initialize(false);
}
conn()->socketHandler()->setOperation(this);
if (conn_options_.getSSLOptionsProviderPtr() && connection_context_) {
connection_context_->isSslConnection = true;
}
// Set timeout for waiting for connection
auto end = timeout_ + start_time_;
auto now = std::chrono::steady_clock::now();
if (now >= end) {
timeoutTriggered();
return;
}
conn()->socketHandler()->scheduleTimeout(
std::chrono::duration_cast<std::chrono::milliseconds>(end - now).count());
auto shared_pool = pool_.lock();
// Remove before to not count against itself
removeClientReference();
if (shared_pool) {
// Sync attributes in conn_options_ with the Operation::attributes_ value
// as pool key uses the attributes from ConnectionOptions
conn_options_.setAttributes(attributes_);
shared_pool->registerForConnection(this);
} else {
VLOG(2) << "Pool is gone, operation must cancel";
cancel();
}
}