Chromium Code Reviews| 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 366702925c619ec1809ded8d3931ab9f806e5c36..e36cb7a0dadbfe5a716aefa154038f490502cf8e 100644 |
| --- a/components/certificate_transparency/log_dns_client.h |
| +++ b/components/certificate_transparency/log_dns_client.h |
| @@ -57,6 +57,18 @@ class LogDnsClient : public net::NetworkChangeNotifier::DNSObserver { |
| // Must be deleted on the same thread that it was created on. |
| ~LogDnsClient() override; |
| + // Gets the number of queries that can be in flight at any one time. |
| + // If this returns 0, there is no limit. |
| + size_t GetMaxConcurrentQueries() const { return max_concurrent_queries_; } |
|
Eran Messeri
2016/09/12 13:26:48
Nit: What use do clients have for this method?
Rob Percival
2016/09/12 17:26:24
Probably none, so I'm happy to remove it.
|
| + |
| + // A limit can be set on the number of concurrent queries by providing a |
| + // positive value for |max_concurrent_queries|. Queries that would exceed this |
| + // limit will fail with net::TEMPORARILY_THROTTLED. Setting this to 0 will |
| + // disable this limit. |
| + void SetMaxConcurrentQueries(size_t max_queries) { |
|
Eran Messeri
2016/09/12 13:26:48
Nit: I'd make the value a c'tor parameter so clien
Rob Percival
2016/09/12 17:26:24
Done.
|
| + max_concurrent_queries_ = max_queries; |
| + } |
| + |
| // Called by NetworkChangeNotifier when the DNS config changes. |
| // The DnsClient's config will be updated in response. |
| void OnDNSChanged() override; |
| @@ -108,6 +120,11 @@ class LogDnsClient : public net::NetworkChangeNotifier::DNSObserver { |
| int net_error, |
| const net::DnsResponse* response); |
| + // Returns true if the maximum number of queries are currently in flight. |
| + // If the maximum number of concurrency queries is set to 0, this will always |
| + // return false. |
| + bool HasMaxConcurrentQueriesInProgress() const; |
| + |
| // Updates the |dns_client_| config using NetworkChangeNotifier. |
| void UpdateDnsConfig(); |
| @@ -126,6 +143,8 @@ class LogDnsClient : public net::NetworkChangeNotifier::DNSObserver { |
| std::list<Query<LeafIndexCallback>> leaf_index_queries_; |
| // Audit proof queries that haven't completed yet. |
| std::list<Query<AuditProofCallback>> audit_proof_queries_; |
| + // The maximum number of queries that can be in flight at one time. |
| + size_t max_concurrent_queries_; |
| // Creates weak_ptrs to this, for callback purposes. |
| base::WeakPtrFactory<LogDnsClient> weak_ptr_factory_; |