| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |