void ConnectOperation::specializedCompleteOperation()

in squangle/mysql_client/Operation.cpp [845:880]


void ConnectOperation::specializedCompleteOperation() {
  // Pass the callbacks to the Connection now that we are done with them
  conn()->setCallbacks(std::move(callbacks_));

  maybeStoreSSLSession();
  // Can only log this on successful connections because unsuccessful
  // ones call mysql_close_free inside libmysql
  if (result_ == OperationResult::Succeeded && conn()->ok() &&
      connection_context_) {
    connection_context_->endpointVersion = conn()->serverInfo();
  }

  // Cancel tcp timeout
  tcp_timeout_handler_.cancelTimeout();

  logConnectCompleted(result_);

  // If connection_initialized_ is false the only way to complete the
  // operation is by cancellation
  DCHECK(conn()->hasInitialized() || result_ == OperationResult::Cancelled);

  conn()->setConnectionOptions(conn_options_);
  conn()->setKillOnQueryTimeout(getKillOnQueryTimeout());
  conn()->setConnectionContext(connection_context_);

  conn()->notify();

  if (connect_callback_) {
    connect_callback_(*this);
    // Release callback since no other callbacks will be made
    connect_callback_ = nullptr;
  }
  // In case this operation didn't even get the chance to run, we still need
  // to remove the reference it added to the async client
  removeClientReference();
}