# File lib/openid/consumer/idres.rb, line 441
      def verify_discovered_services(services, to_match)
        # Search the services resulting from discovery to find one
        # that matches the information from the assertion
        failure_messages = []
        for endpoint in services
          begin
            verify_discovery_single(endpoint, to_match)
          rescue ProtocolError => why
            failure_messages << why.message
          else
            # It matches, so discover verification has
            # succeeded. Return this endpoint.
            @endpoint = endpoint
            return
          end
        end

        Util.log("Discovery verification failure for #{to_match.claimed_id}")
        failure_messages.each do |failure_message|
          Util.log(" * Endpoint mismatch: " + failure_message)
        end

        # XXX: is DiscoveryFailure in Python OpenID
        raise ProtocolError, ("No matching endpoint found after "\
                              "discovering #{to_match.claimed_id}")
      end