Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(883)

Unified Diff: components/certificate_transparency/log_dns_client.h

Issue 2380293002: Adds LogDnsClient::NotifyWhenNotThrottled (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/certificate_transparency/log_dns_client.h
diff --git a/components/certificate_transparency/log_dns_client.h b/components/certificate_transparency/log_dns_client.h
index c63916c32a0c875b21a27ea299f879a85afb2292..145c3a4b5564da62ddcf63c74525440cc0f05e44 100644
--- a/components/certificate_transparency/log_dns_client.h
+++ b/components/certificate_transparency/log_dns_client.h
@@ -61,10 +61,17 @@ class LogDnsClient : public net::NetworkChangeNotifier::DNSObserver {
// Called by NetworkChangeNotifier when the DNS config is first read.
// The DnsClient's config will be updated in response.
void OnInitialDNSConfigRead() override;
+ // Registers a callback to be invoked when the number of concurrent queries
+ // falls below the limit defined by |max_concurrent_queries| (passed to the
+ // constructor of LogDnsClient). This callback will fire once and then be
+ // unregistered. Should only be used if QueryAuditProof() returns
+ // net::ERR_TEMPORARILY_THROTTLED.
+ void NotifyWhenNotThrottled(const base::Closure& callback);
+
// Queries a CT log to retrieve an audit proof for the leaf with |leaf_hash|.
// The log is identified by |domain_for_log|, which is the DNS name used as a
// suffix for all queries.
// The |leaf_hash| is the SHA-256 Merkle leaf hash (see RFC6962, section 2.1).
// The size of the CT log tree, for which the proof is requested, must be
@@ -117,10 +124,12 @@ class LogDnsClient : public net::NetworkChangeNotifier::DNSObserver {
// the end and lookups will typically yield entries at the beginning,
// std::list is an efficient choice.
std::list<std::unique_ptr<AuditProofQuery>> audit_proof_queries_;
// The maximum number of queries that can be in flight at one time.
size_t max_concurrent_queries_;
+ // Callbacks to invoke when the number of concurrent queries is at its limit.
+ std::list<base::Closure> not_throttled_callbacks_;
// Creates weak_ptrs to this, for callback purposes.
base::WeakPtrFactory<LogDnsClient> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(LogDnsClient);
};

Powered by Google App Engine
This is Rietveld 408576698