# File lib/mongo/db.rb, line 101
    def authenticate(username, password, save_auth=true)
      if @connection.pool_size > 1
        if !save_auth
          raise MongoArgumentError, "If using connection pooling, :save_auth must be set to true."
        end
      end

      begin
        socket = @connection.checkout_reader(:primary_preferred)
        issue_authentication(username, password, save_auth, :socket => socket)
      ensure
        socket.checkin if socket
      end

      @connection.authenticate_pools
    end