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

Unified Diff: net/dns/dns_session.cc

Issue 9190031: DnsClient refactoring + features (timeout, suffix search, server rotation). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Delinted. Created 8 years, 11 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
« no previous file with comments | « net/dns/dns_session.h ('k') | net/dns/dns_test_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_session.cc
diff --git a/net/dns/dns_session.cc b/net/dns/dns_session.cc
index 15cbaa209a4eb81752df970af11dd31c60cda27c..fb6c4b4c5ba269157bf7ca29cc7d5c06052ccda1 100644
--- a/net/dns/dns_session.cc
+++ b/net/dns/dns_session.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -24,21 +24,21 @@ DnsSession::DnsSession(const DnsConfig& config,
server_index_(0) {
}
-int DnsSession::NextId() const {
+int DnsSession::NextQueryId() const {
return rand_callback_.Run();
}
-const IPEndPoint& DnsSession::NextServer() {
- // TODO(szym): Rotate servers on failures.
- const IPEndPoint& ipe = config_.nameservers[server_index_];
+int DnsSession::NextFirstServerIndex() {
+ int index = server_index_;
if (config_.rotate)
server_index_ = (server_index_ + 1) % config_.nameservers.size();
- return ipe;
+ return index;
}
base::TimeDelta DnsSession::NextTimeout(int attempt) {
- // TODO(szym): Adapt timeout to observed RTT.
- return config_.timeout * (attempt + 1);
+ // The timeout doubles every full round (each nameserver once).
+ // TODO(szym): Adapt timeout to observed RTT. http://crbug.com/110197
+ return config_.timeout * (1 << (attempt / config_.nameservers.size()));
}
DnsSession::~DnsSession() {}
« no previous file with comments | « net/dns/dns_session.h ('k') | net/dns/dns_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698