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

Side by Side Diff: net/dns/dns_transaction.cc

Issue 14676012: [net/dns] Fix how DnsTransaction computes next server index after fallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/dns/dns_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/dns/dns_transaction.h" 5 #include "net/dns/dns_transaction.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 uint16 id = session_->NextQueryId(); 644 uint16 id = session_->NextQueryId();
645 scoped_ptr<DnsQuery> query; 645 scoped_ptr<DnsQuery> query;
646 if (attempts_.empty()) { 646 if (attempts_.empty()) {
647 query.reset(new DnsQuery(id, qnames_.front(), qtype_)); 647 query.reset(new DnsQuery(id, qnames_.front(), qtype_));
648 } else { 648 } else {
649 query.reset(attempts_[0]->GetQuery()->CloneWithNewId(id)); 649 query.reset(attempts_[0]->GetQuery()->CloneWithNewId(id));
650 } 650 }
651 651
652 const DnsConfig& config = session_->config(); 652 const DnsConfig& config = session_->config();
653 653
654 unsigned server_index = first_server_index_ + 654 unsigned server_index =
655 (attempt_number % config.nameservers.size()); 655 (first_server_index_ + attempt_number) % config.nameservers.size();
656 656
657 scoped_ptr<DnsSession::SocketLease> lease = 657 scoped_ptr<DnsSession::SocketLease> lease =
658 session_->AllocateSocket(server_index, net_log_.source()); 658 session_->AllocateSocket(server_index, net_log_.source());
659 659
660 bool got_socket = !!lease.get(); 660 bool got_socket = !!lease.get();
661 661
662 DnsUDPAttempt* attempt = new DnsUDPAttempt(lease.Pass(), query.Pass()); 662 DnsUDPAttempt* attempt = new DnsUDPAttempt(lease.Pass(), query.Pass());
663 663
664 attempts_.push_back(attempt); 664 attempts_.push_back(attempt);
665 665
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 } // namespace 877 } // namespace
878 878
879 // static 879 // static
880 scoped_ptr<DnsTransactionFactory> DnsTransactionFactory::CreateFactory( 880 scoped_ptr<DnsTransactionFactory> DnsTransactionFactory::CreateFactory(
881 DnsSession* session) { 881 DnsSession* session) {
882 return scoped_ptr<DnsTransactionFactory>( 882 return scoped_ptr<DnsTransactionFactory>(
883 new DnsTransactionFactoryImpl(session)); 883 new DnsTransactionFactoryImpl(session));
884 } 884 }
885 885
886 } // namespace net 886 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/dns/dns_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698